Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- a = {} of Int32 => String
- num = 100_000_000
- puts "doing #{num} records"
- start = Time.now
- 1.upto(num) do |x|
- a[x] = x.to_s
- end
- diff = (Time.now - start).total_seconds
- puts "set: #{diff} -- ( #{(num/diff).to_i} per second)"
- # how much memory we using
- pp `ps -p #{Process.pid} -o rss`
- start = Time.now
- match = num - 1
- 1.upto(num) do |x|
- b = a[x]
- # put second to last one just to make sure...
- if x == match
- puts b
- end
- end
- diff = (Time.now - start).total_seconds
- puts "get: #{diff} -- ( #{(num/diff).to_i} per second )"
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement