Project

General

Profile

new-hash-table-benchmarks.patch

Missed new hash table benchmarks - vmakarov (Vladimir Makarov), 04/30/2016 02:28 PM

View differences:

benchmark/bm_bighash.rb
1
h = {}; 5000000.times {|n| h[n] = n }
benchmark/bm_hash_long.rb
1
k1 = "Ping Pong Ping Pong Ping Pong Ping Pong Ping Pong Ping Pong Ping Pong Ping Pong Ping Pong Ping Pong";
2
k2 = "Pong Ping Pong Ping Pong Ping Pong Ping Pong Ping Pong Ping Pong Ping Pong Ping Pong Ping Pong Ping";
3
h = {k1 => 0, k2 => 0};
4
3000000.times{|i| k = i % 2 ? k2 : k1; h [k] = h[k] + 1}
benchmark/bm_hash_small2.rb
1
1000000.times.map{|i| a={}; 2.times{|j| a[j]=j}; a}
benchmark/bm_hash_small4.rb
1
1000000.times.map{|i| a={}; 4.times{|j| a[j]=j}; a}
benchmark/bm_hash_small8.rb
1
1000000.times.map{|i| a={}; 8.times{|j| a[j]=j}; a}