Sha256: 246a096478b1c7259c5d051beaee0c615be7ada9b47f85d19a920b92db9e77dc
Contents?: true
Size: 626 Bytes
Versions: 8
Compression:
Stored size: 626 Bytes
Contents
require 'sane' require_relative '../ext/google_hash' require 'benchmark' if !ARGV[0].in? ['sparse', 'dense', 'ruby'] puts 'syntax: bench_gc.rb sparse|dense|ruby' exit 1 end p ARGV[0] if ARGV[0] == 'sparse' a = GoogleHashSparseIntToInt.new elsif ARGV[0] == 'dense' a = GoogleHashDenseIntToInt.new elsif ARGV[0] == 'ruby' a = Hash.new else throw 'never get here' end took = Benchmark.realtime { 2_000_000.times {|i| a[i] = i} } p 'took second', took.group_digits, 'mem used:', OS.rss_bytes.group_digits, 'each gc now takes', Benchmark.realtime {GC.start}.group_digits, ObjectSpace.count_objects
Version data entries
8 entries across 8 versions & 1 rubygems