Sha256: af16f0cf56324e6bfb1a32c35e97875fb2c33233ae6509264cc21fbcd12a022b

Contents?: true

Size: 560 Bytes

Versions: 3

Compression:

Stored size: 560 Bytes

Contents

#!/usr/bin/env ruby
# frozen_string_literal: true

require "perf"

system("#{RbConfig.ruby} bin/rake compile", err: :out, exception: true)
require "d_heap/benchmarks"
include DHeap::Benchmarks # rubocop:disable Style/MixinUsage
fill_random_vals

n = ENV.fetch("BENCH_N", 5_000_000).to_i
# interval = ENV.fetch("PROF_INTERVAL", 100).to_i # measured in μs

i = 0

q = initq RbHeap
n.times { q << n }
q.clear

Perf.record do
  while i < n
    q << random_val
    i += 1
  end
  while 0 < i # rubocop:disable Style/NumericPredicate
    q.pop
    i -= 1
  end
end

Version data entries

3 entries across 3 versions & 1 rubygems

Version Path
d_heap-0.6.1 benchmarks/perf.rb
d_heap-0.6.0 benchmarks/perf.rb
d_heap-0.5.0 benchmarks/perf.rb