Compared to python, dictionary lookup is very fast.
Compared to specialized implementations, it’s not so fast. Part of it is that hashing and equality are complicated in julia (e.g.
0x01==1 and therefore both must have the same hash). Another part is that default hashing is not very specialized:
julia> struct x
julia> @btime hash($x(1));
33.641 ns (0 allocations: 0 bytes)
This is ridiculously slow, because it involves a non-inlined runtime call to
jl_object_id. At some point in the future it will probably get faster (someone writes an
if @generated fallback that treats objects as blobs of memory).