> > Sigh, the Lua program doesn't even use local variables in the > inner loop ... Updated the benchmark with declaring x local inside the inner loop instead of just before, which made for some 10% improvements in small/medium sized hashes. Oh, and before anyone thinks this really measures hash table > implementation quality: it's just measuring the overhead of branch > mispredictions and cache misses for an atypical use case of hash > tables. Currently it's measuring different hash algorithms integer lookup performance with a hit rate of 50%. It is a naive benchmark for now because this is currently sufficient to be able to make a point later on. If have some extra time I'll test some variables later on I will test different hit rates and key types. If you have a reference to a source where statistics around hash table use cases is investigated I'll use that as a basis. On Sun, Mar 16, 2014 at 11:57 PM, Mike Pall <mike-1403@xxxxxxxxxx> wrote: > Fredrik Widlund wrote: > > Benchmark of LuaJIT tables vs Java HashMap vs C++ unordered_map > > Sigh, the Lua program doesn't even use local variables in the > inner loop ... > > Oh, and before anyone thinks this really measures hash table > implementation quality: it's just measuring the overhead of branch > mispredictions and cache misses for an atypical use case of hash > tables. > > [Typical hash table accesses use a) string keys with b) a high > temporal correlation and c) they usually have a high hit-rate or a > high miss-rate, but it's rarely 50/50.] > > --Mike > >