Sha256: c9a53e5fbf76c14974909f3fc3b958fd9fcbf3ff93ad018e0a891c828f4062b4

Contents?: true

Size: 848 Bytes

Versions: 102

Compression:

Stored size: 848 Bytes

Contents

#!/usr/bin/env ruby
# encoding: utf-8

require "rubygems"
require "set"
require "thread"
require "benchmark"

require "bunny/concurrent/synchronized_sorted_set"

puts
puts "-" * 80
puts "Benchmarking on #{RUBY_DESCRIPTION}"

n  = 2_000_000
s  = SortedSet.new

# warm up the JIT, etc
puts "Doing a warmup run..."
n.times do |i|
  s << 1
  s << i
  s.delete i
  s << i
end

t1  = Benchmark.realtime do
  n.times do |i|
    s << 1
    s << i
    s.delete i
    s << i
    s.length
  end
end
r1  = (n.to_f/t1.to_f)

s2 = SynchronizedSortedSet.new
t2  = Benchmark.realtime do
  n.times do |i|
    s2 << 1
    s2 << i
    s2.delete i
    s2 << i
    s2.length
  end
end
r2  = (n.to_f/t2.to_f)

puts "Mixed sorted set ops, rate: #{(r1 / 1000).round(2)} KGHz"
puts "Mixed synchronized sorted set ops, rate: #{(r2 / 1000).round(2)} KGHz"
puts
puts "-" * 80

Version data entries

102 entries across 102 versions & 1 rubygems

Version Path
bunny-2.17.0 benchmarks/synchronized_sorted_set.rb
bunny-2.16.1 benchmarks/synchronized_sorted_set.rb
bunny-2.15.0 benchmarks/synchronized_sorted_set.rb
bunny-2.14.4 benchmarks/synchronized_sorted_set.rb
bunny-2.14.3 benchmarks/synchronized_sorted_set.rb
bunny-2.14.2 benchmarks/synchronized_sorted_set.rb
bunny-2.14.1 benchmarks/synchronized_sorted_set.rb
bunny-2.13.0 benchmarks/synchronized_sorted_set.rb
bunny-2.12.1 benchmarks/synchronized_sorted_set.rb
bunny-2.12.0 benchmarks/synchronized_sorted_set.rb
bunny-2.12.0.rc1 benchmarks/synchronized_sorted_set.rb
bunny-2.11.0 benchmarks/synchronized_sorted_set.rb
bunny-2.11.0.pre1 benchmarks/synchronized_sorted_set.rb
bunny-2.10.0 benchmarks/synchronized_sorted_set.rb
bunny-2.9.2 benchmarks/synchronized_sorted_set.rb
bunny-2.9.1 benchmarks/synchronized_sorted_set.rb
bunny-2.6.7 benchmarks/synchronized_sorted_set.rb
bunny-2.7.4 benchmarks/synchronized_sorted_set.rb
bunny-2.8.1 benchmarks/synchronized_sorted_set.rb
bunny-2.9.0 benchmarks/synchronized_sorted_set.rb