Sha256: 4625cc39acef0c0e416ee2fc8e23396ecc6692ec66fbb385cecf7e039bab105b
Contents?: true
Size: 515 Bytes
Versions: 2
Compression:
Stored size: 515 Bytes
Contents
#$:.unshift(File.join(File.dirname(__FILE__), "..", "lib")) require 'rbtree' require "benchmark" def rbt_bm n = 1_000 a1 = []; n.times { a1 << rand(999_999) } a2 = []; n.times { a2 << rand(999_999) } start = Time.now tree = RBTree.new a1.each {|e| tree[e] = e } a2.each {|e| tree[e] } n.times do tree.delete_if{|k, v| v == rand(999_999)} end return Time.now - start end N = (ARGV[0] || 5).to_i N.times do puts rbt_bm.to_f puts "GC.count = #{GC.count}" if GC.respond_to?(:count) end
Version data entries
2 entries across 2 versions & 1 rubygems
Version | Path |
---|---|
rbtree-jruby-0.2.1 | benchmark/bm.rb |
rbtree-jruby-0.2.0 | benchmark/bm.rb |