Skip to content

Commit

Permalink
Add alpha and numeric keyed Hash workloads
Browse files Browse the repository at this point in the history
Set the env var `N` to specify the size of the Hash to test. For
example, in a Windows CMD.EXE:

  for %I in (1,2) do @set N=%I && @echo N=%I && rci bench core_hash_num_size_N
  • Loading branch information
jonforums committed Feb 1, 2012
1 parent 8a8cafb commit 2ffb866
Show file tree
Hide file tree
Showing 2 changed files with 25 additions and 0 deletions.
13 changes: 13 additions & 0 deletions workloads/core_hash_alpha_size_N.rb
@@ -0,0 +1,13 @@
c = (ENV['MEASURE_EXTENDED'] || 1).to_i

# set env var `N` to desired Hash size to test
n = (ENV['N'] || 6).to_i

k = 'aaa'
c.times do
500_000.times do
h = {}
n.times { h[k] = true; h[k]; k = k.succ }
h.each { |k,_| h[k] = h[k] }
end
end
12 changes: 12 additions & 0 deletions workloads/core_hash_num_size_N.rb
@@ -0,0 +1,12 @@
c = (ENV['MEASURE_EXTENDED'] || 1).to_i

# set env var `N` to desired Hash size to test
n = (ENV['N'] || 6).to_i

c.times do
500_000.times do
h = {}
n.times { |i| h[i] = true; h[i] }
h.each { |k,_| h[k] = h[k] }
end
end

0 comments on commit 2ffb866

Please sign in to comment.