diff options
Diffstat (limited to 'benchmark')
-rw-r--r-- | benchmark/bm_bighash.rb | 1 | ||||
-rw-r--r-- | benchmark/bm_hash_long.rb | 4 | ||||
-rw-r--r-- | benchmark/bm_hash_small2.rb | 1 | ||||
-rw-r--r-- | benchmark/bm_hash_small4.rb | 1 | ||||
-rw-r--r-- | benchmark/bm_hash_small8.rb | 1 |
5 files changed, 8 insertions, 0 deletions
diff --git a/benchmark/bm_bighash.rb b/benchmark/bm_bighash.rb new file mode 100644 index 0000000000..e2ad5a5c94 --- /dev/null +++ b/benchmark/bm_bighash.rb @@ -0,0 +1 @@ +h = {}; 5000000.times {|n| h[n] = n } diff --git a/benchmark/bm_hash_long.rb b/benchmark/bm_hash_long.rb new file mode 100644 index 0000000000..03d9109602 --- /dev/null +++ b/benchmark/bm_hash_long.rb @@ -0,0 +1,4 @@ +k1 = "Ping Pong Ping Pong Ping Pong Ping Pong Ping Pong Ping Pong Ping Pong Ping Pong Ping Pong Ping Pong"; +k2 = "Pong Ping Pong Ping Pong Ping Pong Ping Pong Ping Pong Ping Pong Ping Pong Ping Pong Ping Pong Ping"; +h = {k1 => 0, k2 => 0}; +3000000.times{|i| k = i % 2 ? k2 : k1; h [k] = h[k] + 1} diff --git a/benchmark/bm_hash_small2.rb b/benchmark/bm_hash_small2.rb new file mode 100644 index 0000000000..45485d9c71 --- /dev/null +++ b/benchmark/bm_hash_small2.rb @@ -0,0 +1 @@ +1000000.times.map{|i| a={}; 2.times{|j| a[j]=j}; a} diff --git a/benchmark/bm_hash_small4.rb b/benchmark/bm_hash_small4.rb new file mode 100644 index 0000000000..acd4084334 --- /dev/null +++ b/benchmark/bm_hash_small4.rb @@ -0,0 +1 @@ +1000000.times.map{|i| a={}; 4.times{|j| a[j]=j}; a} diff --git a/benchmark/bm_hash_small8.rb b/benchmark/bm_hash_small8.rb new file mode 100644 index 0000000000..9cffcc91b6 --- /dev/null +++ b/benchmark/bm_hash_small8.rb @@ -0,0 +1 @@ +1000000.times.map{|i| a={}; 8.times{|j| a[j]=j}; a} |