Sha256: 47e5e5107a0e87c6ccf58023f27b5c5ea0c85c20e6fce8a504b161eb2fcb3e87

Contents?: true

Size: 1.08 KB

Versions: 2

Compression:

Stored size: 1.08 KB

Contents

---
prelude: |
  system("#{RbConfig.ruby} bin/rake compile", err: :out, exception: true)
  require "d_heap/benchmarks"
  include DHeap::Benchmarks
  fill_random_vals

  N = ENV.fetch("BENCH_N", 1000).to_i
  N2 = N * 2

  i = j = 0

benchmark:
  - script: &script |
      if i < N
        q.clear if __bmdv_i == 0
        q << random_val
        i += 1

      elsif j < N
        q.pop
        j += 1

      elsif q.empty?
        i = 1
        j = 0
        q.clear
        q << random_val

      else
        raise "q not empty!"
      end

    name:    "push N + pop N (findmin)"
    prelude: "q = initq FindMin"
    loop_count:   200000
  - script: *script
    name:    "push N + pop N (bsearch)"
    prelude: "q = initq BSearch"
    loop_count:  4000000
  - script: *script
    name:    "push N + pop N (rb_heap)"
    prelude: "q = initq RbHeap"
    loop_count:  4000000
  - script: *script
    name:    "push N + pop N (c++ stl)"
    prelude: "q = initq CppSTL"
    loop_count: 16000000
  - script: *script
    name:    "push N + pop N (c_dheap)"
    prelude: "q = initq DHeap"
    loop_count: 16000000

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
d_heap-0.6.1 benchmarks/push_n_pop_n.yml
d_heap-0.6.0 benchmarks/push_n_pop_n.yml