3 ms·
> (And now I also wonder if any compilers and VMs precompute hashes for map and object keys.) I don't think i've ever come across one that does. But then, in m
by twic 8y ago
> (And now I also wonder if any compilers and VMs precompute hashes for map and object keys.)
I don't think i've ever come across one that does. But then, in most situations where they could, they can do something even more efficient anyway. Fast JS compilers replace an object's hashtable with a dense array of fields, accessed by index. Lots of language implementations do method lookup in a vtable, rather than a dictionary.