d_heap 0.6.1 → 0.7.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/.clang-format +21 -0
- data/.github/workflows/main.yml +16 -1
- data/.rubocop.yml +1 -0
- data/CHANGELOG.md +17 -0
- data/{N → D} +1 -1
- data/README.md +313 -261
- data/d_heap.gemspec +16 -5
- data/docs/benchmarks-2.txt +79 -61
- data/docs/benchmarks.txt +587 -416
- data/docs/profile.txt +99 -133
- data/ext/d_heap/.rubocop.yml +7 -0
- data/ext/d_heap/d_heap.c +575 -424
- data/ext/d_heap/extconf.rb +34 -3
- data/images/push_n.png +0 -0
- data/images/push_n_pop_n.png +0 -0
- data/images/push_pop.png +0 -0
- data/lib/d_heap.rb +25 -1
- data/lib/d_heap/version.rb +1 -1
- metadata +6 -30
- data/.rspec +0 -3
- data/.travis.yml +0 -6
- data/Gemfile +0 -20
- data/Gemfile.lock +0 -83
- data/Rakefile +0 -20
- data/benchmarks/perf.rb +0 -29
- data/benchmarks/push_n.yml +0 -35
- data/benchmarks/push_n_pop_n.yml +0 -52
- data/benchmarks/push_pop.yml +0 -32
- data/benchmarks/stackprof.rb +0 -31
- data/bin/bench_charts +0 -13
- data/bin/bench_n +0 -7
- data/bin/benchmark-driver +0 -29
- data/bin/benchmarks +0 -10
- data/bin/console +0 -15
- data/bin/profile +0 -10
- data/bin/rake +0 -29
- data/bin/rspec +0 -29
- data/bin/rubocop +0 -29
- data/bin/setup +0 -8
- data/lib/benchmark_driver/runner/ips_zero_fail.rb +0 -158
- data/lib/d_heap/benchmarks.rb +0 -112
- data/lib/d_heap/benchmarks/benchmarker.rb +0 -116
- data/lib/d_heap/benchmarks/implementations.rb +0 -224
- data/lib/d_heap/benchmarks/profiler.rb +0 -71
- data/lib/d_heap/benchmarks/rspec_matchers.rb +0 -352
data/d_heap.gemspec
CHANGED
@@ -8,7 +8,7 @@ Gem::Specification.new do |spec|
|
|
8
8
|
spec.authors = ["nicholas a. evans"]
|
9
9
|
spec.email = ["nicholas.evans@gmail.com"]
|
10
10
|
|
11
|
-
spec.summary = "
|
11
|
+
spec.summary = "very fast min-heap priority queue"
|
12
12
|
spec.description = <<~DESC
|
13
13
|
A C extension implementation of a d-ary heap data structure, suitable for
|
14
14
|
use in e.g. priority queues or Djikstra's algorithm.
|
@@ -21,11 +21,22 @@ Gem::Specification.new do |spec|
|
|
21
21
|
spec.metadata["source_code_uri"] = spec.homepage
|
22
22
|
spec.metadata["changelog_uri"] = "#{spec.homepage}/blob/master/CHANGELOG.md"
|
23
23
|
|
24
|
-
# Specify which files should be added to the gem when it is released.
|
25
|
-
#
|
26
|
-
|
27
|
-
`git ls-files -z`.split("\x0")
|
24
|
+
# Specify which files should be added to the gem when it is released. The
|
25
|
+
# `git ls-files -z` loads the files in the gem that have been added into git.
|
26
|
+
git_ls_files = Dir.chdir(File.expand_path(__dir__)) {
|
27
|
+
`git ls-files -z`.split("\x0")
|
28
28
|
}
|
29
|
+
exclude_paths_re = %r{
|
30
|
+
\A(
|
31
|
+
\.rspec|
|
32
|
+
Rakefile|
|
33
|
+
Gemfile|
|
34
|
+
N\z|
|
35
|
+
(benchmarks|bin|spec)/|
|
36
|
+
lib/d_heap/benchmarks
|
37
|
+
)
|
38
|
+
}x
|
39
|
+
spec.files = git_ls_files.reject {|f| f.match(exclude_paths_re) }
|
29
40
|
spec.bindir = "exe"
|
30
41
|
spec.executables = spec.files.grep(%r{^exe/}) {|f| File.basename(f) }
|
31
42
|
spec.require_paths = ["lib"]
|
data/docs/benchmarks-2.txt
CHANGED
@@ -1,75 +1,93 @@
|
|
1
|
+
Benchmarking run at 2021-01-25 23:31:48 -0500
|
2
|
+
ruby v2.7.2, DHeap v0.6.1
|
3
|
+
|
1
4
|
Warming up --------------------------------------
|
2
|
-
push + pop (findmin)
|
3
|
-
push + pop (bsearch)
|
4
|
-
push + pop (rb_heap)
|
5
|
-
push + pop (c++ stl)
|
6
|
-
push + pop (c_dheap)
|
5
|
+
push + pop (findmin) 135.463 i/s - 686.000 times in 5.064119s (7.38ms/i)
|
6
|
+
push + pop (bsearch) 5.453k i/s - 27.489k times in 5.040925s (183.38μs/i)
|
7
|
+
push + pop (rb_heap) 647.863k i/s - 3.270M times in 5.048030s (1.54μs/i)
|
8
|
+
push + pop (c++ stl) 3.923M i/s - 19.658M times in 5.011369s (254.93ns/i, 587clocks/i)
|
9
|
+
push + pop (c_dheap) 5.613M i/s - 28.125M times in 5.010621s (178.16ns/i, 450clocks/i)
|
7
10
|
Calculating -------------------------------------
|
8
|
-
|
9
|
-
push + pop (findmin)
|
10
|
-
push + pop (bsearch)
|
11
|
-
push + pop (rb_heap)
|
12
|
-
push + pop (c++ stl)
|
13
|
-
push + pop (c_dheap)
|
11
|
+
N 1000000 N 10000000 N 3162278 N 316228 N 100000 N 31623 N 10000 N 3162 N 1000 N 316 N 100 N 32 N 10
|
12
|
+
push + pop (findmin) 135.943 12.869 41.182 343.249 1.097k 3.587k 12.631k 50.336k 224.814k 948.877k 2.595M 4.202M 5.480M i/s - 2.031k times in 14.940053s 157.815976s 49.317074s 5.916981s 1.850898s 0.566265s 0.160799s 0.040349s 0.009034s 0.002140s 0.000783s 0.000483s 0.000371s
|
13
|
+
push + pop (bsearch) 5.356k 281.895 971.955 26.362k 81.121k 412.392k 1.210M 1.829M 2.203M 2.396M 2.904M 3.214M 3.931M i/s - 81.797k times in 15.271966s 290.167837s 84.157151s 3.102831s 1.008328s 0.198348s 0.067624s 0.044714s 0.037127s 0.034134s 0.028165s 0.025451s 0.020806s
|
14
|
+
push + pop (rb_heap) 673.578k 467.512k 465.936k 718.419k 732.549k 943.118k 950.389k 1.062M 1.263M 1.356M 1.604M 1.857M 2.326M i/s - 9.718M times in 14.427345s 20.786487s 20.856821s 13.526848s 13.265927s 10.304049s 10.225219s 9.152454s 7.697285s 7.165792s 6.060302s 5.233045s 4.178291s
|
15
|
+
push + pop (c++ stl) 4.171M 2.737M 3.458M 4.402M 4.842M 5.503M 5.731M 6.319M 6.899M 7.084M 7.393M 7.772M 7.707M i/s - 58.839M times in 14.106950s 21.496544s 17.014548s 13.366627s 12.150850s 10.692853s 10.266595s 9.311420s 8.528926s 8.305938s 7.958634s 7.570905s 7.634693s
|
16
|
+
push + pop (c_dheap) 6.490M 3.735M 5.231M 7.280M 7.150M 7.670M 8.045M 8.704M 9.340M 9.688M 9.669M 9.921M 10.196M i/s - 84.195M times in 12.972480s 22.542978s 16.096451s 11.564531s 11.775039s 10.976519s 10.465346s 9.673356s 9.014859s 8.690250s 8.707992s 8.486921s 8.257262s
|
14
17
|
|
15
18
|
Comparison:
|
16
19
|
push + pop (findmin)
|
17
|
-
|
18
|
-
|
19
|
-
|
20
|
-
|
21
|
-
|
22
|
-
|
23
|
-
|
24
|
-
|
25
|
-
|
26
|
-
|
20
|
+
N 10: 5480288.0 i/s
|
21
|
+
N 32: 4202409.8 i/s - 1.30x slower
|
22
|
+
N 100: 2595178.8 i/s - 2.11x slower
|
23
|
+
N 316: 948876.5 i/s - 5.78x slower
|
24
|
+
N 1000: 224813.9 i/s - 24.38x slower
|
25
|
+
N 3162: 50336.4 i/s - 108.87x slower
|
26
|
+
N 10000: 12630.7 i/s - 433.89x slower
|
27
|
+
N 31623: 3586.7 i/s - 1527.96x slower
|
28
|
+
N 100000: 1097.3 i/s - 4994.31x slower
|
29
|
+
N 316228: 343.2 i/s - 15965.91x slower
|
30
|
+
N 1000000: 135.9 i/s - 40313.05x slower
|
31
|
+
N 3162278: 41.2 i/s - 133073.25x slower
|
32
|
+
N 10000000: 12.9 i/s - 425838.01x slower
|
27
33
|
|
28
34
|
push + pop (bsearch)
|
29
|
-
|
30
|
-
|
31
|
-
|
32
|
-
|
33
|
-
|
34
|
-
|
35
|
-
|
36
|
-
|
37
|
-
|
38
|
-
|
35
|
+
N 10: 3931408.4 i/s
|
36
|
+
N 32: 3213952.9 i/s - 1.22x slower
|
37
|
+
N 100: 2904181.8 i/s - 1.35x slower
|
38
|
+
N 316: 2396374.2 i/s - 1.64x slower
|
39
|
+
N 1000: 2203157.1 i/s - 1.78x slower
|
40
|
+
N 3162: 1829352.1 i/s - 2.15x slower
|
41
|
+
N 10000: 1209584.9 i/s - 3.25x slower
|
42
|
+
N 31623: 412392.2 i/s - 9.53x slower
|
43
|
+
N 100000: 81121.4 i/s - 48.46x slower
|
44
|
+
N 316228: 26362.1 i/s - 149.13x slower
|
45
|
+
N 1000000: 5356.0 i/s - 734.02x slower
|
46
|
+
N 3162278: 972.0 i/s - 4044.84x slower
|
47
|
+
N 10000000: 281.9 i/s - 13946.33x slower
|
39
48
|
|
40
49
|
push + pop (rb_heap)
|
41
|
-
|
42
|
-
|
43
|
-
|
44
|
-
|
45
|
-
|
46
|
-
|
47
|
-
|
48
|
-
|
49
|
-
|
50
|
-
|
50
|
+
N 10: 2325816.5 i/s
|
51
|
+
N 32: 1857033.5 i/s - 1.25x slower
|
52
|
+
N 100: 1603540.3 i/s - 1.45x slower
|
53
|
+
N 316: 1356156.9 i/s - 1.72x slower
|
54
|
+
N 1000: 1262515.2 i/s - 1.84x slower
|
55
|
+
N 3162: 1061785.1 i/s - 2.19x slower
|
56
|
+
N 10000: 950389.3 i/s - 2.45x slower
|
57
|
+
N 31623: 943118.5 i/s - 2.47x slower
|
58
|
+
N 100000: 732548.8 i/s - 3.17x slower
|
59
|
+
N 316228: 718418.6 i/s - 3.24x slower
|
60
|
+
N 1000000: 673577.8 i/s - 3.45x slower
|
61
|
+
N 10000000: 467512.3 i/s - 4.97x slower
|
62
|
+
N 3162278: 465935.8 i/s - 4.99x slower
|
51
63
|
|
52
64
|
push + pop (c++ stl)
|
53
|
-
|
54
|
-
|
55
|
-
|
56
|
-
|
57
|
-
|
58
|
-
|
59
|
-
|
60
|
-
|
61
|
-
|
62
|
-
|
65
|
+
N 32: 7771751.1 i/s
|
66
|
+
N 10: 7706818.6 i/s - 1.01x slower
|
67
|
+
N 100: 7393127.3 i/s - 1.05x slower
|
68
|
+
N 316: 7083991.6 i/s - 1.10x slower
|
69
|
+
N 1000: 6898781.3 i/s - 1.13x slower
|
70
|
+
N 3162: 6319035.6 i/s - 1.23x slower
|
71
|
+
N 10000: 5731130.5 i/s - 1.36x slower
|
72
|
+
N 31623: 5502665.3 i/s - 1.41x slower
|
73
|
+
N 100000: 4842393.2 i/s - 1.60x slower
|
74
|
+
N 316228: 4401947.6 i/s - 1.77x slower
|
75
|
+
N 1000000: 4170936.4 i/s - 1.86x slower
|
76
|
+
N 3162278: 3458169.7 i/s - 2.25x slower
|
77
|
+
N 10000000: 2737146.6 i/s - 2.84x slower
|
63
78
|
|
64
79
|
push + pop (c_dheap)
|
65
|
-
|
66
|
-
|
67
|
-
|
68
|
-
|
69
|
-
|
70
|
-
|
71
|
-
|
72
|
-
|
73
|
-
|
74
|
-
|
80
|
+
N 10: 10196454.1 i/s
|
81
|
+
N 32: 9920533.6 i/s - 1.03x slower
|
82
|
+
N 316: 9688419.5 i/s - 1.05x slower
|
83
|
+
N 100: 9668679.8 i/s - 1.05x slower
|
84
|
+
N 1000: 9339557.0 i/s - 1.09x slower
|
85
|
+
N 3162: 8703782.7 i/s - 1.17x slower
|
86
|
+
N 10000: 8045103.0 i/s - 1.27x slower
|
87
|
+
N 31623: 7670445.6 i/s - 1.33x slower
|
88
|
+
N 316228: 7280432.6 i/s - 1.40x slower
|
89
|
+
N 100000: 7150276.7 i/s - 1.43x slower
|
90
|
+
N 1000000: 6490261.6 i/s - 1.57x slower
|
91
|
+
N 3162278: 5230642.9 i/s - 1.95x slower
|
92
|
+
N 10000000: 3734856.5 i/s - 2.73x slower
|
75
93
|
|
data/docs/benchmarks.txt
CHANGED
@@ -1,515 +1,686 @@
|
|
1
|
-
Benchmarking run at 2021-01-
|
2
|
-
ruby v2.7.2, DHeap v0.
|
1
|
+
Benchmarking run at 2021-01-31 08:31:50 -0500
|
2
|
+
ruby v2.7.2, DHeap v0.6.1
|
3
3
|
|
4
4
|
################################################################################
|
5
|
-
# Benchmarks with N=
|
5
|
+
# Benchmarks with N=10
|
6
6
|
################################################################################
|
7
7
|
|
8
|
-
== push N (N=
|
9
|
-
Warming up --------------------------------------
|
10
|
-
push N (bsearch) 921.113k i/s - 1.862M times in 2.021033s (1.09μs/i)
|
11
|
-
push N (rb_heap) 953.542k i/s - 1.933M times in 2.026956s (1.05μs/i)
|
12
|
-
push N (c++ stl) 989.247k i/s - 2.038M times in 2.060495s (1.01μs/i)
|
13
|
-
push N (c_dheap) 1.922M i/s - 3.928M times in 2.043907s (520.30ns/i)
|
8
|
+
== push N (N=10) ==============================================================
|
14
9
|
Calculating -------------------------------------
|
15
|
-
push N (
|
16
|
-
push N (
|
17
|
-
push N (
|
18
|
-
push N (
|
10
|
+
push N (findmin) 9.717M i/s - 30.000M times in 3.087359s (102.91ns/i, 254clocks/i)
|
11
|
+
push N (bsearch) 4.320M i/s - 600.000k times in 0.138891s (231.49ns/i, 496clocks/i)
|
12
|
+
push N (rb_heap) 5.404M i/s - 12.000M times in 2.220663s (185.06ns/i, 422clocks/i)
|
13
|
+
push N (c++ stl) 6.378M i/s - 18.000M times in 2.822057s (156.78ns/i, 395clocks/i)
|
14
|
+
push N (c_dheap) 10.371M i/s - 30.000M times in 2.892808s (96.43ns/i, 273clocks/i)
|
19
15
|
|
20
16
|
Comparison:
|
21
|
-
push N (c_dheap):
|
22
|
-
push N (
|
23
|
-
push N (
|
24
|
-
push N (
|
17
|
+
push N (c_dheap): 10370547.5 i/s
|
18
|
+
push N (findmin): 9717043.7 i/s - 1.07x slower
|
19
|
+
push N (c++ stl): 6378325.6 i/s - 1.63x slower
|
20
|
+
push N (rb_heap): 5403792.2 i/s - 1.92x slower
|
21
|
+
push N (bsearch): 4319927.8 i/s - 2.40x slower
|
25
22
|
|
26
|
-
== push N then pop N (N=
|
27
|
-
|
28
|
-
push N + pop N (findmin)
|
29
|
-
push N + pop N (bsearch)
|
30
|
-
push N + pop N (rb_heap)
|
31
|
-
push N + pop N (c++ stl)
|
32
|
-
push N + pop N (c_dheap)
|
33
|
-
|
34
|
-
|
35
|
-
push N + pop N (
|
36
|
-
push N + pop N (
|
37
|
-
push N + pop N (
|
38
|
-
push N + pop N (
|
39
|
-
|
40
|
-
|
41
|
-
|
42
|
-
push N + pop N (c++ stl): 1134997.5 i/s - 1.21x slower
|
43
|
-
push N + pop N (findmin): 862913.1 i/s - 1.59x slower
|
44
|
-
push N + pop N (bsearch): 762887.1 i/s - 1.80x slower
|
45
|
-
push N + pop N (rb_heap): 506890.4 i/s - 2.71x slower
|
46
|
-
|
47
|
-
== Push/pop with pre-filled queue (size=N) (N=5) ==============================
|
23
|
+
== push N then pop N (N=10) ====================================================
|
24
|
+
Calculating -------------------------------------
|
25
|
+
push N + pop N (findmin) 7.721M i/s - 300.000k times in 0.038854s (129.51ns/i, 377clocks/i)
|
26
|
+
push N + pop N (bsearch) 6.780M i/s - 1.200M times in 0.177001s (147.50ns/i, 401clocks/i)
|
27
|
+
push N + pop N (rb_heap) 4.231M i/s - 6.000M times in 1.418156s (236.36ns/i, 517clocks/i)
|
28
|
+
push N + pop N (c++ stl) 10.608M i/s - 18.000M times in 1.696896s (94.27ns/i, 214clocks/i)
|
29
|
+
push N + pop N (c_dheap) 12.916M i/s - 18.000M times in 1.393570s (77.42ns/i, 136clocks/i)
|
30
|
+
|
31
|
+
Comparison:
|
32
|
+
push N + pop N (c_dheap): 12916469.1 i/s
|
33
|
+
push N + pop N (c++ stl): 10607602.3 i/s - 1.22x slower
|
34
|
+
push N + pop N (findmin): 7721268.8 i/s - 1.67x slower
|
35
|
+
push N + pop N (bsearch): 6779608.4 i/s - 1.91x slower
|
36
|
+
push N + pop N (rb_heap): 4230845.4 i/s - 3.05x slower
|
37
|
+
|
38
|
+
== Push/pop with pre-filled queue (size=N) (N=10) ==============================
|
48
39
|
Warming up --------------------------------------
|
49
|
-
push + pop (findmin) 5.
|
50
|
-
push + pop (bsearch)
|
51
|
-
push + pop (rb_heap) 2.
|
52
|
-
push + pop (c++ stl)
|
53
|
-
push + pop (c_dheap) 8.
|
40
|
+
push + pop (findmin) 5.119M i/s - 5.238M times in 1.023417s (195.37ns/i, 458clocks/i)
|
41
|
+
push + pop (bsearch) 3.791M i/s - 3.940M times in 1.039431s (263.79ns/i, 510clocks/i)
|
42
|
+
push + pop (rb_heap) 2.312M i/s - 2.376M times in 1.027837s (432.61ns/i)
|
43
|
+
push + pop (c++ stl) 7.247M i/s - 7.344M times in 1.013381s (137.99ns/i, 366clocks/i)
|
44
|
+
push + pop (c_dheap) 8.918M i/s - 9.151M times in 1.026085s (112.13ns/i, 223clocks/i)
|
54
45
|
Calculating -------------------------------------
|
55
|
-
push + pop (findmin) 5.
|
56
|
-
push + pop (bsearch)
|
57
|
-
push + pop (rb_heap) 2.
|
58
|
-
push + pop (c++ stl) 7.
|
59
|
-
push + pop (c_dheap) 9.
|
46
|
+
push + pop (findmin) 5.413M i/s - 15.356M times in 2.837024s (184.75ns/i, 534clocks/i)
|
47
|
+
push + pop (bsearch) 3.971M i/s - 11.373M times in 2.863579s (251.80ns/i, 604clocks/i)
|
48
|
+
push + pop (rb_heap) 2.296M i/s - 6.935M times in 3.020761s (435.61ns/i, 951clocks/i)
|
49
|
+
push + pop (c++ stl) 7.823M i/s - 21.741M times in 2.778978s (127.82ns/i, 282clocks/i)
|
50
|
+
push + pop (c_dheap) 9.854M i/s - 26.755M times in 2.715009s (101.48ns/i, 243clocks/i)
|
60
51
|
|
61
52
|
Comparison:
|
62
|
-
push + pop (c_dheap):
|
63
|
-
push + pop (c++ stl):
|
64
|
-
push + pop (findmin):
|
65
|
-
push + pop (bsearch):
|
66
|
-
push + pop (rb_heap):
|
53
|
+
push + pop (c_dheap): 9854472.6 i/s
|
54
|
+
push + pop (c++ stl): 7823282.4 i/s - 1.26x slower
|
55
|
+
push + pop (findmin): 5412632.1 i/s - 1.82x slower
|
56
|
+
push + pop (bsearch): 3971475.8 i/s - 2.48x slower
|
57
|
+
push + pop (rb_heap): 2295653.2 i/s - 4.29x slower
|
67
58
|
|
68
59
|
################################################################################
|
69
|
-
# Benchmarks with N=
|
60
|
+
# Benchmarks with N=30
|
70
61
|
################################################################################
|
71
62
|
|
72
|
-
== push N (N=
|
73
|
-
Warming up --------------------------------------
|
74
|
-
push N (bsearch) 172.478k i/s - 359.942k times in 2.086881s (5.80μs/i)
|
75
|
-
push N (rb_heap) 206.237k i/s - 426.074k times in 2.065940s (4.85μs/i)
|
76
|
-
push N (c++ stl) 317.575k i/s - 652.828k times in 2.055665s (3.15μs/i)
|
77
|
-
push N (c_dheap) 488.947k i/s - 991.484k times in 2.027793s (2.05μs/i)
|
63
|
+
== push N (N=30) ==============================================================
|
78
64
|
Calculating -------------------------------------
|
79
|
-
push N (
|
80
|
-
push N (
|
81
|
-
push N (
|
82
|
-
push N (
|
65
|
+
push N (findmin) 10.040M i/s - 30.000M times in 2.987977s (99.60ns/i, 198clocks/i)
|
66
|
+
push N (bsearch) 3.544M i/s - 600.000k times in 0.169307s (282.18ns/i, 757clocks/i)
|
67
|
+
push N (rb_heap) 5.017M i/s - 12.000M times in 2.391690s (199.31ns/i, 471clocks/i)
|
68
|
+
push N (c++ stl) 7.401M i/s - 18.000M times in 2.432254s (135.13ns/i, 282clocks/i)
|
69
|
+
push N (c_dheap) 10.496M i/s - 30.000M times in 2.858330s (95.28ns/i, 207clocks/i)
|
83
70
|
|
84
71
|
Comparison:
|
85
|
-
push N (c_dheap):
|
86
|
-
push N (
|
87
|
-
push N (
|
88
|
-
push N (
|
72
|
+
push N (c_dheap): 10495639.7 i/s
|
73
|
+
push N (findmin): 10040237.6 i/s - 1.05x slower
|
74
|
+
push N (c++ stl): 7400542.2 i/s - 1.42x slower
|
75
|
+
push N (rb_heap): 5017372.7 i/s - 2.09x slower
|
76
|
+
push N (bsearch): 3543867.6 i/s - 2.96x slower
|
89
77
|
|
90
|
-
== push N then pop N (N=
|
91
|
-
Warming up --------------------------------------
|
92
|
-
push N + pop N (findmin) 160.307k i/s - 331.191k times in 2.065978s (6.24μs/i)
|
93
|
-
push N + pop N (bsearch) 136.665k i/s - 280.830k times in 2.054882s (7.32μs/i)
|
94
|
-
push N + pop N (rb_heap) 77.997k i/s - 156.492k times in 2.006388s (12.82μs/i)
|
95
|
-
push N + pop N (c++ stl) 243.819k i/s - 489.279k times in 2.006731s (4.10μs/i)
|
96
|
-
push N + pop N (c_dheap) 295.254k i/s - 597.410k times in 2.023373s (3.39μs/i)
|
97
|
-
Calculating -------------------------------------
|
98
|
-
push N + pop N (findmin) 161.999k i/s - 961.842k times in 5.937343s (6.17μs/i)
|
99
|
-
push N + pop N (bsearch) 143.432k i/s - 819.988k times in 5.716901s (6.97μs/i)
|
100
|
-
push N + pop N (rb_heap) 79.622k i/s - 467.981k times in 5.877529s (12.56μs/i)
|
101
|
-
push N + pop N (c++ stl) 252.227k i/s - 1.463M times in 5.799983s (3.96μs/i)
|
102
|
-
push N + pop N (c_dheap) 298.350k i/s - 1.772M times in 5.937739s (3.35μs/i)
|
103
|
-
|
104
|
-
Comparison:
|
105
|
-
push N + pop N (c_dheap): 298350.3 i/s
|
106
|
-
push N + pop N (c++ stl): 252227.1 i/s - 1.18x slower
|
107
|
-
push N + pop N (findmin): 161998.7 i/s - 1.84x slower
|
108
|
-
push N + pop N (bsearch): 143432.3 i/s - 2.08x slower
|
109
|
-
push N + pop N (rb_heap): 79622.1 i/s - 3.75x slower
|
110
|
-
|
111
|
-
== Push/pop with pre-filled queue (size=N) (N=21) ==============================
|
112
|
-
Warming up --------------------------------------
|
113
|
-
push + pop (findmin) 4.383M i/s - 8.832M times in 2.014937s (228.13ns/i, 482clocks/i)
|
114
|
-
push + pop (bsearch) 3.357M i/s - 6.859M times in 2.042965s (297.84ns/i, 709clocks/i)
|
115
|
-
push + pop (rb_heap) 1.885M i/s - 3.852M times in 2.043333s (530.48ns/i, 698clocks/i)
|
116
|
-
push + pop (c++ stl) 6.362M i/s - 12.844M times in 2.018810s (157.18ns/i, 438clocks/i)
|
117
|
-
push + pop (c_dheap) 7.644M i/s - 15.337M times in 2.006451s (130.83ns/i, 350clocks/i)
|
78
|
+
== push N then pop N (N=30) ====================================================
|
118
79
|
Calculating -------------------------------------
|
119
|
-
push + pop (findmin)
|
120
|
-
push + pop (bsearch)
|
121
|
-
push + pop (rb_heap)
|
122
|
-
push + pop (c++ stl)
|
123
|
-
push + pop (c_dheap)
|
80
|
+
push N + pop N (findmin) 6.343M i/s - 300.000k times in 0.047296s (157.65ns/i, 353clocks/i)
|
81
|
+
push N + pop N (bsearch) 5.591M i/s - 1.200M times in 0.214624s (178.85ns/i, 332clocks/i)
|
82
|
+
push N + pop N (rb_heap) 3.162M i/s - 6.000M times in 1.897529s (316.25ns/i, 812clocks/i)
|
83
|
+
push N + pop N (c++ stl) 10.068M i/s - 18.000M times in 1.787868s (99.33ns/i, 203clocks/i)
|
84
|
+
push N + pop N (c_dheap) 11.903M i/s - 18.000M times in 1.512286s (84.02ns/i, 238clocks/i)
|
124
85
|
|
125
86
|
Comparison:
|
126
|
-
push + pop (c_dheap):
|
127
|
-
push + pop (c++ stl):
|
128
|
-
push + pop (findmin):
|
129
|
-
push + pop (bsearch):
|
130
|
-
push + pop (rb_heap):
|
87
|
+
push N + pop N (c_dheap): 11902512.2 i/s
|
88
|
+
push N + pop N (c++ stl): 10067858.5 i/s - 1.18x slower
|
89
|
+
push N + pop N (findmin): 6343031.3 i/s - 1.88x slower
|
90
|
+
push N + pop N (bsearch): 5591174.8 i/s - 2.13x slower
|
91
|
+
push N + pop N (rb_heap): 3162007.3 i/s - 3.76x slower
|
131
92
|
|
132
93
|
################################################################################
|
133
|
-
# Benchmarks with N=
|
94
|
+
# Benchmarks with N=32
|
134
95
|
################################################################################
|
135
96
|
|
136
|
-
==
|
97
|
+
== Push/pop with pre-filled queue (size=N) (N=32) ==============================
|
137
98
|
Warming up --------------------------------------
|
138
|
-
|
139
|
-
|
140
|
-
|
141
|
-
|
99
|
+
push + pop (findmin) 4.146M i/s - 4.168M times in 1.005262s (241.19ns/i, 574clocks/i)
|
100
|
+
push + pop (bsearch) 3.067M i/s - 3.218M times in 1.049417s (326.09ns/i, 940clocks/i)
|
101
|
+
push + pop (rb_heap) 1.849M i/s - 1.915M times in 1.036008s (540.96ns/i)
|
102
|
+
push + pop (c++ stl) 6.561M i/s - 6.661M times in 1.015169s (152.40ns/i, 278clocks/i)
|
103
|
+
push + pop (c_dheap) 8.786M i/s - 9.051M times in 1.030185s (113.82ns/i, 258clocks/i)
|
142
104
|
Calculating -------------------------------------
|
143
|
-
|
144
|
-
|
145
|
-
|
146
|
-
|
105
|
+
push + pop (findmin) 4.478M i/s - 12.438M times in 2.777667s (223.31ns/i, 487clocks/i)
|
106
|
+
push + pop (bsearch) 3.196M i/s - 9.200M times in 2.878768s (312.91ns/i, 813clocks/i)
|
107
|
+
push + pop (rb_heap) 1.796M i/s - 5.546M times in 3.087197s (556.68ns/i)
|
108
|
+
push + pop (c++ stl) 7.578M i/s - 19.684M times in 2.597487s (131.96ns/i, 282clocks/i)
|
109
|
+
push + pop (c_dheap) 9.929M i/s - 26.357M times in 2.654479s (100.71ns/i, 239clocks/i)
|
147
110
|
|
148
111
|
Comparison:
|
149
|
-
|
150
|
-
|
151
|
-
|
152
|
-
|
112
|
+
push + pop (c_dheap): 9929261.3 i/s
|
113
|
+
push + pop (c++ stl): 7578283.3 i/s - 1.31x slower
|
114
|
+
push + pop (findmin): 4477993.9 i/s - 2.22x slower
|
115
|
+
push + pop (bsearch): 3195760.4 i/s - 3.11x slower
|
116
|
+
push + pop (rb_heap): 1796358.4 i/s - 5.53x slower
|
153
117
|
|
154
|
-
|
155
|
-
|
156
|
-
|
157
|
-
|
158
|
-
push N
|
159
|
-
|
160
|
-
push N
|
161
|
-
|
162
|
-
push N
|
163
|
-
push N
|
164
|
-
push N
|
165
|
-
|
166
|
-
|
167
|
-
|
168
|
-
|
169
|
-
push N
|
170
|
-
push N
|
171
|
-
push N
|
172
|
-
|
173
|
-
push N
|
174
|
-
|
175
|
-
|
118
|
+
################################################################################
|
119
|
+
# Benchmarks with N=100
|
120
|
+
################################################################################
|
121
|
+
|
122
|
+
== push N (N=100) ==============================================================
|
123
|
+
Calculating -------------------------------------
|
124
|
+
push N (findmin) 9.981M i/s - 30.000M times in 3.005825s (100.19ns/i, 288clocks/i)
|
125
|
+
push N (bsearch) 2.769M i/s - 600.000k times in 0.216676s (361.13ns/i, 855clocks/i)
|
126
|
+
push N (rb_heap) 4.608M i/s - 12.000M times in 2.604252s (217.02ns/i, 522clocks/i)
|
127
|
+
push N (c++ stl) 7.992M i/s - 18.000M times in 2.252363s (125.13ns/i, 314clocks/i)
|
128
|
+
push N (c_dheap) 10.523M i/s - 30.000M times in 2.850989s (95.03ns/i, 246clocks/i)
|
129
|
+
|
130
|
+
Comparison:
|
131
|
+
push N (c_dheap): 10522662.6 i/s
|
132
|
+
push N (findmin): 9980622.3 i/s - 1.05x slower
|
133
|
+
push N (c++ stl): 7991608.3 i/s - 1.32x slower
|
134
|
+
push N (rb_heap): 4607849.4 i/s - 2.28x slower
|
135
|
+
push N (bsearch): 2769106.2 i/s - 3.80x slower
|
136
|
+
|
137
|
+
== push N then pop N (N=100) ==================================================
|
138
|
+
Calculating -------------------------------------
|
139
|
+
push N + pop N (findmin) 4.321M i/s - 300.000k times in 0.069422s (231.41ns/i, 481clocks/i)
|
140
|
+
push N + pop N (bsearch) 4.809M i/s - 1.200M times in 0.249544s (207.95ns/i, 525clocks/i)
|
141
|
+
push N + pop N (rb_heap) 2.467M i/s - 6.000M times in 2.431693s (405.28ns/i)
|
142
|
+
push N + pop N (c++ stl) 9.317M i/s - 18.000M times in 1.931923s (107.33ns/i, 258clocks/i)
|
143
|
+
push N + pop N (c_dheap) 10.954M i/s - 18.000M times in 1.643165s (91.29ns/i, 262clocks/i)
|
144
|
+
|
145
|
+
Comparison:
|
146
|
+
push N + pop N (c_dheap): 10954469.2 i/s
|
147
|
+
push N + pop N (c++ stl): 9317140.2 i/s - 1.18x slower
|
148
|
+
push N + pop N (bsearch): 4808770.2 i/s - 2.28x slower
|
149
|
+
push N + pop N (findmin): 4321411.9 i/s - 2.53x slower
|
150
|
+
push N + pop N (rb_heap): 2467417.0 i/s - 4.44x slower
|
151
|
+
|
152
|
+
== Push/pop with pre-filled queue (size=N) (N=100) ============================
|
176
153
|
Warming up --------------------------------------
|
177
|
-
push + pop (findmin) 3.
|
178
|
-
push + pop (bsearch) 2.
|
179
|
-
push + pop (rb_heap) 1.
|
180
|
-
push + pop (c++ stl) 6.
|
181
|
-
push + pop (c_dheap)
|
154
|
+
push + pop (findmin) 3.032M i/s - 3.085M times in 1.017682s (329.84ns/i, 793clocks/i)
|
155
|
+
push + pop (bsearch) 2.602M i/s - 2.672M times in 1.026732s (384.28ns/i, 759clocks/i)
|
156
|
+
push + pop (rb_heap) 1.551M i/s - 1.609M times in 1.038011s (644.94ns/i)
|
157
|
+
push + pop (c++ stl) 6.826M i/s - 6.861M times in 1.005153s (146.49ns/i, 427clocks/i)
|
158
|
+
push + pop (c_dheap) 8.588M i/s - 8.702M times in 1.013307s (116.44ns/i, 247clocks/i)
|
182
159
|
Calculating -------------------------------------
|
183
|
-
push + pop (findmin) 3.
|
184
|
-
push + pop (bsearch) 2.
|
185
|
-
push + pop (rb_heap) 1.
|
186
|
-
push + pop (c++ stl) 7.
|
187
|
-
push + pop (c_dheap)
|
160
|
+
push + pop (findmin) 3.149M i/s - 9.095M times in 2.887963s (317.52ns/i, 768clocks/i)
|
161
|
+
push + pop (bsearch) 2.854M i/s - 7.807M times in 2.735737s (350.43ns/i, 720clocks/i)
|
162
|
+
push + pop (rb_heap) 1.571M i/s - 4.652M times in 2.960926s (636.54ns/i)
|
163
|
+
push + pop (c++ stl) 7.579M i/s - 20.479M times in 2.702015s (131.94ns/i, 331clocks/i)
|
164
|
+
push + pop (c_dheap) 9.567M i/s - 25.765M times in 2.693102s (104.53ns/i, 210clocks/i)
|
188
165
|
|
189
166
|
Comparison:
|
190
|
-
push + pop (c_dheap):
|
191
|
-
push + pop (c++ stl):
|
192
|
-
push + pop (findmin):
|
193
|
-
push + pop (bsearch):
|
194
|
-
push + pop (rb_heap):
|
167
|
+
push + pop (c_dheap): 9566872.5 i/s
|
168
|
+
push + pop (c++ stl): 7579103.1 i/s - 1.26x slower
|
169
|
+
push + pop (findmin): 3149419.4 i/s - 3.04x slower
|
170
|
+
push + pop (bsearch): 2853617.8 i/s - 3.35x slower
|
171
|
+
push + pop (rb_heap): 1570998.7 i/s - 6.09x slower
|
195
172
|
|
196
173
|
################################################################################
|
197
|
-
# Benchmarks with N=
|
174
|
+
# Benchmarks with N=300
|
198
175
|
################################################################################
|
199
176
|
|
200
|
-
== push N (N=
|
201
|
-
Warming up --------------------------------------
|
202
|
-
push N (bsearch) 6.761k i/s - 13.860k times in 2.049946s (147.90μs/i)
|
203
|
-
push N (rb_heap) 11.284k i/s - 23.040k times in 2.041838s (88.62μs/i)
|
204
|
-
push N (c++ stl) 23.839k i/s - 49.266k times in 2.066605s (41.95μs/i)
|
205
|
-
push N (c_dheap) 30.654k i/s - 63.420k times in 2.068901s (32.62μs/i)
|
177
|
+
== push N (N=300) ==============================================================
|
206
178
|
Calculating -------------------------------------
|
207
|
-
push N (
|
208
|
-
push N (
|
209
|
-
push N (
|
210
|
-
push N (
|
179
|
+
push N (findmin) 10.204M i/s - 30.000M times in 2.940004s (98.00ns/i, 159clocks/i)
|
180
|
+
push N (bsearch) 2.360M i/s - 600.000k times in 0.254221s (423.70ns/i, 935clocks/i)
|
181
|
+
push N (rb_heap) 4.463M i/s - 12.000M times in 2.689036s (224.09ns/i, 530clocks/i)
|
182
|
+
push N (c++ stl) 8.204M i/s - 18.000M times in 2.193957s (121.89ns/i, 356clocks/i)
|
183
|
+
push N (c_dheap) 10.554M i/s - 30.000M times in 2.842477s (94.75ns/i, 276clocks/i)
|
211
184
|
|
212
185
|
Comparison:
|
213
|
-
push N (c_dheap):
|
214
|
-
push N (
|
215
|
-
push N (
|
216
|
-
push N (
|
186
|
+
push N (c_dheap): 10554176.5 i/s
|
187
|
+
push N (findmin): 10204068.1 i/s - 1.03x slower
|
188
|
+
push N (c++ stl): 8204354.5 i/s - 1.29x slower
|
189
|
+
push N (rb_heap): 4462566.4 i/s - 2.37x slower
|
190
|
+
push N (bsearch): 2360150.2 i/s - 4.47x slower
|
217
191
|
|
218
|
-
== push N then pop N (N=
|
219
|
-
Warming up --------------------------------------
|
220
|
-
push N + pop N (findmin) 3.013k i/s - 6.040k times in 2.004514s (331.87μs/i)
|
221
|
-
push N + pop N (bsearch) 6.202k i/s - 12.684k times in 2.045306s (161.25μs/i)
|
222
|
-
push N + pop N (rb_heap) 3.028k i/s - 6.100k times in 2.014435s (330.24μs/i)
|
223
|
-
push N + pop N (c++ stl) 13.177k i/s - 27.006k times in 2.049544s (75.89μs/i)
|
224
|
-
push N + pop N (c_dheap) 15.142k i/s - 31.563k times in 2.084497s (66.04μs/i)
|
225
|
-
Calculating -------------------------------------
|
226
|
-
push N + pop N (findmin) 3.025k i/s - 18.079k times in 5.976274s (330.56μs/i)
|
227
|
-
push N + pop N (bsearch) 5.906k i/s - 37.209k times in 6.300596s (169.33μs/i)
|
228
|
-
push N + pop N (rb_heap) 3.008k i/s - 18.168k times in 6.039305s (332.41μs/i)
|
229
|
-
push N + pop N (c++ stl) 13.135k i/s - 79.059k times in 6.018814s (76.13μs/i)
|
230
|
-
push N + pop N (c_dheap) 15.142k i/s - 90.850k times in 5.999735s (66.04μs/i)
|
231
|
-
|
232
|
-
Comparison:
|
233
|
-
push N + pop N (c_dheap): 15142.3 i/s
|
234
|
-
push N + pop N (c++ stl): 13135.3 i/s - 1.15x slower
|
235
|
-
push N + pop N (bsearch): 5905.6 i/s - 2.56x slower
|
236
|
-
push N + pop N (findmin): 3025.1 i/s - 5.01x slower
|
237
|
-
push N + pop N (rb_heap): 3008.3 i/s - 5.03x slower
|
238
|
-
|
239
|
-
== Push/pop with pre-filled queue (size=N) (N=341) ============================
|
240
|
-
Warming up --------------------------------------
|
241
|
-
push + pop (findmin) 1.508M i/s - 3.048M times in 2.020819s (662.94ns/i)
|
242
|
-
push + pop (bsearch) 2.149M i/s - 4.337M times in 2.017794s (465.25ns/i)
|
243
|
-
push + pop (rb_heap) 1.144M i/s - 2.313M times in 2.021027s (873.78ns/i)
|
244
|
-
push + pop (c++ stl) 5.897M i/s - 11.981M times in 2.031688s (169.57ns/i, 484clocks/i)
|
245
|
-
push + pop (c_dheap) 7.452M i/s - 14.981M times in 2.010401s (134.20ns/i, 367clocks/i)
|
192
|
+
== push N then pop N (N=300) ==================================================
|
246
193
|
Calculating -------------------------------------
|
247
|
-
push + pop (findmin)
|
248
|
-
push + pop (bsearch)
|
249
|
-
push + pop (rb_heap)
|
250
|
-
push + pop (c++ stl)
|
251
|
-
push + pop (c_dheap)
|
194
|
+
push N + pop N (findmin) 2.307M i/s - 300.000k times in 0.130056s (433.52ns/i, 903clocks/i)
|
195
|
+
push N + pop N (bsearch) 4.125M i/s - 1.200M times in 0.290889s (242.41ns/i, 593clocks/i)
|
196
|
+
push N + pop N (rb_heap) 2.101M i/s - 6.000M times in 2.855417s (475.90ns/i, 844clocks/i)
|
197
|
+
push N + pop N (c++ stl) 8.707M i/s - 18.000M times in 2.067240s (114.85ns/i, 318clocks/i)
|
198
|
+
push N + pop N (c_dheap) 10.261M i/s - 18.000M times in 1.754140s (97.45ns/i, 277clocks/i)
|
252
199
|
|
253
200
|
Comparison:
|
254
|
-
push + pop (c_dheap):
|
255
|
-
push + pop (c++ stl):
|
256
|
-
push + pop (bsearch):
|
257
|
-
push + pop (findmin):
|
258
|
-
push + pop (rb_heap):
|
201
|
+
push N + pop N (c_dheap): 10261436.2 i/s
|
202
|
+
push N + pop N (c++ stl): 8707262.9 i/s - 1.18x slower
|
203
|
+
push N + pop N (bsearch): 4125279.4 i/s - 2.49x slower
|
204
|
+
push N + pop N (findmin): 2306706.5 i/s - 4.45x slower
|
205
|
+
push N + pop N (rb_heap): 2101269.3 i/s - 4.88x slower
|
259
206
|
|
260
207
|
################################################################################
|
261
|
-
# Benchmarks with N=
|
208
|
+
# Benchmarks with N=316
|
262
209
|
################################################################################
|
263
210
|
|
264
|
-
==
|
211
|
+
== Push/pop with pre-filled queue (size=N) (N=316) ============================
|
265
212
|
Warming up --------------------------------------
|
266
|
-
|
267
|
-
|
268
|
-
|
269
|
-
|
213
|
+
push + pop (findmin) 1.627M i/s - 1.651M times in 1.014236s (614.50ns/i)
|
214
|
+
push + pop (bsearch) 2.260M i/s - 2.313M times in 1.023385s (442.46ns/i)
|
215
|
+
push + pop (rb_heap) 1.288M i/s - 1.347M times in 1.045779s (776.16ns/i)
|
216
|
+
push + pop (c++ stl) 6.086M i/s - 6.295M times in 1.034346s (164.31ns/i, 427clocks/i)
|
217
|
+
push + pop (c_dheap) 8.076M i/s - 8.226M times in 1.018582s (123.83ns/i, 324clocks/i)
|
270
218
|
Calculating -------------------------------------
|
271
|
-
|
272
|
-
|
273
|
-
|
274
|
-
|
219
|
+
push + pop (findmin) 1.668M i/s - 4.882M times in 2.926147s (599.37ns/i)
|
220
|
+
push + pop (bsearch) 2.345M i/s - 6.780M times in 2.891943s (426.52ns/i)
|
221
|
+
push + pop (rb_heap) 1.269M i/s - 3.865M times in 3.045697s (787.98ns/i)
|
222
|
+
push + pop (c++ stl) 6.870M i/s - 18.258M times in 2.657550s (145.55ns/i, 289clocks/i)
|
223
|
+
push + pop (c_dheap) 9.665M i/s - 24.227M times in 2.506716s (103.47ns/i, 221clocks/i)
|
275
224
|
|
276
225
|
Comparison:
|
277
|
-
|
278
|
-
|
279
|
-
|
280
|
-
|
226
|
+
push + pop (c_dheap): 9664758.0 i/s
|
227
|
+
push + pop (c++ stl): 6870377.3 i/s - 1.41x slower
|
228
|
+
push + pop (bsearch): 2344530.3 i/s - 4.12x slower
|
229
|
+
push + pop (findmin): 1668416.3 i/s - 5.79x slower
|
230
|
+
push + pop (rb_heap): 1269060.0 i/s - 7.62x slower
|
281
231
|
|
282
|
-
|
283
|
-
|
284
|
-
|
285
|
-
|
286
|
-
push N
|
287
|
-
|
288
|
-
push N
|
289
|
-
|
290
|
-
push N
|
291
|
-
push N
|
292
|
-
push N
|
293
|
-
|
294
|
-
|
295
|
-
|
296
|
-
|
297
|
-
push N
|
298
|
-
push N
|
299
|
-
push N
|
300
|
-
|
301
|
-
push N
|
302
|
-
|
303
|
-
|
232
|
+
################################################################################
|
233
|
+
# Benchmarks with N=1,000
|
234
|
+
################################################################################
|
235
|
+
|
236
|
+
== push N (N=1000) ============================================================
|
237
|
+
Calculating -------------------------------------
|
238
|
+
push N (findmin) 10.267M i/s - 30.000M times in 2.921868s (97.40ns/i, 243clocks/i)
|
239
|
+
push N (bsearch) 2.000M i/s - 600.000k times in 0.300058s (500.10ns/i)
|
240
|
+
push N (rb_heap) 4.408M i/s - 12.000M times in 2.722517s (226.88ns/i, 488clocks/i)
|
241
|
+
push N (c++ stl) 8.171M i/s - 18.000M times in 2.202936s (122.39ns/i, 254clocks/i)
|
242
|
+
push N (c_dheap) 10.455M i/s - 30.000M times in 2.869530s (95.65ns/i, 224clocks/i)
|
243
|
+
|
244
|
+
Comparison:
|
245
|
+
push N (c_dheap): 10454672.5 i/s
|
246
|
+
push N (findmin): 10267402.5 i/s - 1.02x slower
|
247
|
+
push N (c++ stl): 8170912.6 i/s - 1.28x slower
|
248
|
+
push N (rb_heap): 4407685.6 i/s - 2.37x slower
|
249
|
+
push N (bsearch): 1999614.9 i/s - 5.23x slower
|
250
|
+
|
251
|
+
== push N then pop N (N=1000) ==================================================
|
252
|
+
Calculating -------------------------------------
|
253
|
+
push N + pop N (findmin) 735.090k i/s - 300.000k times in 0.408113s (1.36μs/i)
|
254
|
+
push N + pop N (bsearch) 3.587M i/s - 1.200M times in 0.334586s (278.82ns/i, 742clocks/i)
|
255
|
+
push N + pop N (rb_heap) 1.799M i/s - 6.000M times in 3.336039s (556.01ns/i)
|
256
|
+
push N + pop N (c++ stl) 8.115M i/s - 18.000M times in 2.218185s (123.23ns/i, 292clocks/i)
|
257
|
+
push N + pop N (c_dheap) 9.283M i/s - 18.000M times in 1.939036s (107.72ns/i, 253clocks/i)
|
258
|
+
|
259
|
+
Comparison:
|
260
|
+
push N + pop N (c_dheap): 9282962.9 i/s
|
261
|
+
push N + pop N (c++ stl): 8114741.7 i/s - 1.14x slower
|
262
|
+
push N + pop N (bsearch): 3586521.9 i/s - 2.59x slower
|
263
|
+
push N + pop N (rb_heap): 1798540.1 i/s - 5.16x slower
|
264
|
+
push N + pop N (findmin): 735090.3 i/s - 12.63x slower
|
265
|
+
|
266
|
+
== Push/pop with pre-filled queue (size=N) (N=1000) ============================
|
304
267
|
Warming up --------------------------------------
|
305
|
-
push + pop (findmin)
|
306
|
-
push + pop (bsearch)
|
307
|
-
push + pop (rb_heap) 1.
|
308
|
-
push + pop (c++ stl)
|
309
|
-
push + pop (c_dheap) 6.
|
268
|
+
push + pop (findmin) 657.093k i/s - 672.360k times in 1.023235s (1.52μs/i)
|
269
|
+
push + pop (bsearch) 2.094M i/s - 2.182M times in 1.041939s (477.56ns/i)
|
270
|
+
push + pop (rb_heap) 1.228M i/s - 1.278M times in 1.040514s (814.00ns/i)
|
271
|
+
push + pop (c++ stl) 6.181M i/s - 6.238M times in 1.009224s (161.78ns/i, 375clocks/i)
|
272
|
+
push + pop (c_dheap) 6.881M i/s - 6.986M times in 1.015318s (145.33ns/i, 347clocks/i)
|
310
273
|
Calculating -------------------------------------
|
311
|
-
push + pop (findmin)
|
312
|
-
push + pop (bsearch) 2.
|
313
|
-
push + pop (rb_heap) 1.
|
314
|
-
push + pop (c++ stl) 6.
|
315
|
-
push + pop (c_dheap)
|
274
|
+
push + pop (findmin) 656.982k i/s - 1.971M times in 3.000502s (1.52μs/i)
|
275
|
+
push + pop (bsearch) 2.159M i/s - 6.282M times in 2.909771s (463.19ns/i, 907clocks/i)
|
276
|
+
push + pop (rb_heap) 1.214M i/s - 3.685M times in 3.035461s (823.62ns/i)
|
277
|
+
push + pop (c++ stl) 6.866M i/s - 18.543M times in 2.700613s (145.64ns/i, 347clocks/i)
|
278
|
+
push + pop (c_dheap) 9.168M i/s - 20.643M times in 2.251669s (109.08ns/i, 223clocks/i)
|
316
279
|
|
317
280
|
Comparison:
|
318
|
-
push + pop (c_dheap):
|
319
|
-
push + pop (c++ stl):
|
320
|
-
push + pop (bsearch):
|
321
|
-
push + pop (rb_heap):
|
322
|
-
push + pop (findmin):
|
281
|
+
push + pop (c_dheap): 9167926.8 i/s
|
282
|
+
push + pop (c++ stl): 6866291.1 i/s - 1.34x slower
|
283
|
+
push + pop (bsearch): 2158927.2 i/s - 4.25x slower
|
284
|
+
push + pop (rb_heap): 1214146.7 i/s - 7.55x slower
|
285
|
+
push + pop (findmin): 656982.4 i/s - 13.95x slower
|
323
286
|
|
324
287
|
################################################################################
|
325
|
-
# Benchmarks with N=
|
288
|
+
# Benchmarks with N=3,000
|
326
289
|
################################################################################
|
327
290
|
|
328
|
-
== push N (N=
|
329
|
-
Warming up --------------------------------------
|
330
|
-
push N (bsearch) 269.520 i/s - 560.000 times in 2.077767s (3.71ms/i)
|
331
|
-
push N (rb_heap) 717.703 i/s - 1.440k times in 2.006402s (1.39ms/i)
|
332
|
-
push N (c++ stl) 1.462k i/s - 3.045k times in 2.082734s (683.99μs/i)
|
333
|
-
push N (c_dheap) 1.823k i/s - 3.780k times in 2.073303s (548.49μs/i)
|
291
|
+
== push N (N=3000) ============================================================
|
334
292
|
Calculating -------------------------------------
|
335
|
-
push N (
|
336
|
-
push N (
|
337
|
-
push N (
|
338
|
-
push N (
|
293
|
+
push N (findmin) 10.260M i/s - 30.000M times in 2.923922s (97.46ns/i, 237clocks/i)
|
294
|
+
push N (bsearch) 1.694M i/s - 600.000k times in 0.354106s (590.18ns/i)
|
295
|
+
push N (rb_heap) 4.415M i/s - 12.000M times in 2.717734s (226.48ns/i, 545clocks/i)
|
296
|
+
push N (c++ stl) 7.991M i/s - 18.000M times in 2.252536s (125.14ns/i, 309clocks/i)
|
297
|
+
push N (c_dheap) 10.524M i/s - 30.000M times in 2.850733s (95.02ns/i, 205clocks/i)
|
339
298
|
|
340
299
|
Comparison:
|
341
|
-
push N (c_dheap):
|
342
|
-
push N (
|
343
|
-
push N (
|
344
|
-
push N (
|
300
|
+
push N (c_dheap): 10523609.1 i/s
|
301
|
+
push N (findmin): 10260193.1 i/s - 1.03x slower
|
302
|
+
push N (c++ stl): 7990992.5 i/s - 1.32x slower
|
303
|
+
push N (rb_heap): 4415442.7 i/s - 2.38x slower
|
304
|
+
push N (bsearch): 1694409.5 i/s - 6.21x slower
|
345
305
|
|
346
|
-
== push N then pop N (N=
|
306
|
+
== push N then pop N (N=3000) ==================================================
|
307
|
+
Calculating -------------------------------------
|
308
|
+
push N + pop N (bsearch) 3.095M i/s - 1.200M times in 0.387763s (323.14ns/i, 873clocks/i)
|
309
|
+
push N + pop N (rb_heap) 1.617M i/s - 6.000M times in 3.709670s (618.28ns/i)
|
310
|
+
push N + pop N (c++ stl) 7.892M i/s - 18.000M times in 2.280843s (126.71ns/i, 307clocks/i)
|
311
|
+
push N + pop N (c_dheap) 8.742M i/s - 18.000M times in 2.059004s (114.39ns/i, 337clocks/i)
|
312
|
+
|
313
|
+
Comparison:
|
314
|
+
push N + pop N (c_dheap): 8742091.2 i/s
|
315
|
+
push N + pop N (c++ stl): 7891817.5 i/s - 1.11x slower
|
316
|
+
push N + pop N (bsearch): 3094677.1 i/s - 2.82x slower
|
317
|
+
push N + pop N (rb_heap): 1617394.7 i/s - 5.41x slower
|
318
|
+
|
319
|
+
################################################################################
|
320
|
+
# Benchmarks with N=3,162
|
321
|
+
################################################################################
|
322
|
+
|
323
|
+
== Push/pop with pre-filled queue (size=N) (N=3162) ============================
|
347
324
|
Warming up --------------------------------------
|
348
|
-
push
|
349
|
-
push
|
350
|
-
push
|
351
|
-
push
|
352
|
-
push
|
353
|
-
Calculating -------------------------------------
|
354
|
-
push
|
355
|
-
push
|
356
|
-
push
|
357
|
-
push
|
358
|
-
push
|
359
|
-
|
360
|
-
Comparison:
|
361
|
-
push
|
362
|
-
push
|
363
|
-
push
|
364
|
-
push
|
365
|
-
push
|
366
|
-
|
367
|
-
|
325
|
+
push + pop (findmin) 218.524k i/s - 225.030k times in 1.029772s (4.58μs/i)
|
326
|
+
push + pop (bsearch) 1.784M i/s - 1.818M times in 1.018826s (560.50ns/i)
|
327
|
+
push + pop (rb_heap) 906.303k i/s - 906.848k times in 1.000601s (1.10μs/i)
|
328
|
+
push + pop (c++ stl) 5.662M i/s - 5.788M times in 1.022279s (176.61ns/i, 397clocks/i)
|
329
|
+
push + pop (c_dheap) 7.653M i/s - 7.799M times in 1.019106s (130.67ns/i, 268clocks/i)
|
330
|
+
Calculating -------------------------------------
|
331
|
+
push + pop (findmin) 213.811k i/s - 655.572k times in 3.066131s (4.68μs/i)
|
332
|
+
push + pop (bsearch) 1.942M i/s - 5.352M times in 2.755670s (514.86ns/i)
|
333
|
+
push + pop (rb_heap) 945.426k i/s - 2.719M times in 2.875855s (1.06μs/i)
|
334
|
+
push + pop (c++ stl) 6.251M i/s - 16.987M times in 2.717417s (159.97ns/i, 371clocks/i)
|
335
|
+
push + pop (c_dheap) 8.645M i/s - 22.958M times in 2.655715s (115.68ns/i, 266clocks/i)
|
336
|
+
|
337
|
+
Comparison:
|
338
|
+
push + pop (c_dheap): 8644863.6 i/s
|
339
|
+
push + pop (c++ stl): 6251071.8 i/s - 1.38x slower
|
340
|
+
push + pop (bsearch): 1942294.3 i/s - 4.45x slower
|
341
|
+
push + pop (rb_heap): 945426.2 i/s - 9.14x slower
|
342
|
+
push + pop (findmin): 213810.8 i/s - 40.43x slower
|
343
|
+
|
344
|
+
################################################################################
|
345
|
+
# Benchmarks with N=10,000
|
346
|
+
################################################################################
|
347
|
+
|
348
|
+
== push N (N=10000) ============================================================
|
349
|
+
Calculating -------------------------------------
|
350
|
+
push N (findmin) 10.192M i/s - 30.000M times in 2.943544s (98.12ns/i, 210clocks/i)
|
351
|
+
push N (bsearch) 1.214M i/s - 600.000k times in 0.494405s (824.01ns/i)
|
352
|
+
push N (rb_heap) 4.369M i/s - 12.000M times in 2.746465s (228.87ns/i, 494clocks/i)
|
353
|
+
push N (c++ stl) 8.211M i/s - 18.000M times in 2.192209s (121.79ns/i, 258clocks/i)
|
354
|
+
push N (c_dheap) 10.445M i/s - 30.000M times in 2.872301s (95.74ns/i, 230clocks/i)
|
355
|
+
|
356
|
+
Comparison:
|
357
|
+
push N (c_dheap): 10444588.3 i/s
|
358
|
+
push N (findmin): 10191797.4 i/s - 1.02x slower
|
359
|
+
push N (c++ stl): 8210895.4 i/s - 1.27x slower
|
360
|
+
push N (rb_heap): 4369252.9 i/s - 2.39x slower
|
361
|
+
push N (bsearch): 1213580.4 i/s - 8.61x slower
|
362
|
+
|
363
|
+
== push N then pop N (N=10000) ================================================
|
364
|
+
Calculating -------------------------------------
|
365
|
+
push N + pop N (bsearch) 2.257M i/s - 1.200M times in 0.531668s (443.06ns/i)
|
366
|
+
push N + pop N (rb_heap) 1.439M i/s - 6.000M times in 4.168970s (694.83ns/i)
|
367
|
+
push N + pop N (c++ stl) 7.366M i/s - 18.000M times in 2.443772s (135.77ns/i, 353clocks/i)
|
368
|
+
push N + pop N (c_dheap) 8.084M i/s - 18.000M times in 2.226631s (123.70ns/i, 269clocks/i)
|
369
|
+
|
370
|
+
Comparison:
|
371
|
+
push N + pop N (c_dheap): 8083962.7 i/s
|
372
|
+
push N + pop N (c++ stl): 7365661.8 i/s - 1.10x slower
|
373
|
+
push N + pop N (bsearch): 2257047.9 i/s - 3.58x slower
|
374
|
+
push N + pop N (rb_heap): 1439204.3 i/s - 5.62x slower
|
375
|
+
|
376
|
+
== Push/pop with pre-filled queue (size=N) (N=10000) ==========================
|
368
377
|
Warming up --------------------------------------
|
369
|
-
push + pop (findmin)
|
370
|
-
push + pop (bsearch) 1.
|
371
|
-
push + pop (rb_heap)
|
372
|
-
push + pop (c++ stl)
|
373
|
-
push + pop (c_dheap) 6.
|
378
|
+
push + pop (findmin) 38.436k i/s - 38.985k times in 1.014294s (26.02μs/i)
|
379
|
+
push + pop (bsearch) 1.701M i/s - 1.806M times in 1.061608s (587.89ns/i)
|
380
|
+
push + pop (rb_heap) 829.401k i/s - 851.418k times in 1.026545s (1.21μs/i)
|
381
|
+
push + pop (c++ stl) 4.996M i/s - 5.179M times in 1.036658s (200.16ns/i, 533clocks/i)
|
382
|
+
push + pop (c_dheap) 6.884M i/s - 6.916M times in 1.004562s (145.26ns/i, 320clocks/i)
|
374
383
|
Calculating -------------------------------------
|
375
|
-
push + pop (findmin)
|
376
|
-
push + pop (bsearch) 1.
|
377
|
-
push + pop (rb_heap)
|
378
|
-
push + pop (c++ stl) 5.
|
379
|
-
push + pop (c_dheap)
|
384
|
+
push + pop (findmin) 42.033k i/s - 115.306k times in 2.743242s (23.79μs/i)
|
385
|
+
push + pop (bsearch) 1.699M i/s - 5.103M times in 3.003166s (588.51ns/i)
|
386
|
+
push + pop (rb_heap) 844.004k i/s - 2.488M times in 2.948094s (1.18μs/i)
|
387
|
+
push + pop (c++ stl) 5.720M i/s - 14.988M times in 2.620286s (174.83ns/i, 439clocks/i)
|
388
|
+
push + pop (c_dheap) 8.029M i/s - 20.653M times in 2.572341s (124.55ns/i, 239clocks/i)
|
380
389
|
|
381
390
|
Comparison:
|
382
|
-
push + pop (c_dheap):
|
383
|
-
push + pop (c++ stl):
|
384
|
-
push + pop (bsearch):
|
385
|
-
push + pop (rb_heap):
|
386
|
-
push + pop (findmin):
|
391
|
+
push + pop (c_dheap): 8028814.5 i/s
|
392
|
+
push + pop (c++ stl): 5719855.1 i/s - 1.40x slower
|
393
|
+
push + pop (bsearch): 1699219.0 i/s - 4.73x slower
|
394
|
+
push + pop (rb_heap): 844004.1 i/s - 9.51x slower
|
395
|
+
push + pop (findmin): 42032.8 i/s - 191.01x slower
|
387
396
|
|
388
397
|
################################################################################
|
389
|
-
# Benchmarks with N=
|
398
|
+
# Benchmarks with N=30,000
|
390
399
|
################################################################################
|
391
400
|
|
392
|
-
== push N (N=
|
401
|
+
== push N (N=30000) ============================================================
|
402
|
+
Calculating -------------------------------------
|
403
|
+
push N (findmin) 10.286M i/s - 30.000M times in 2.916695s (97.22ns/i, 246clocks/i)
|
404
|
+
push N (bsearch) 626.769k i/s - 600.000k times in 0.957290s (1.60μs/i)
|
405
|
+
push N (rb_heap) 4.372M i/s - 12.000M times in 2.744993s (228.75ns/i, 586clocks/i)
|
406
|
+
push N (c++ stl) 7.925M i/s - 18.000M times in 2.271289s (126.18ns/i, 363clocks/i)
|
407
|
+
push N (c_dheap) 10.471M i/s - 30.000M times in 2.865042s (95.50ns/i, 209clocks/i)
|
408
|
+
|
409
|
+
Comparison:
|
410
|
+
push N (c_dheap): 10471051.5 i/s
|
411
|
+
push N (findmin): 10285616.0 i/s - 1.02x slower
|
412
|
+
push N (c++ stl): 7925015.4 i/s - 1.32x slower
|
413
|
+
push N (rb_heap): 4371595.7 i/s - 2.40x slower
|
414
|
+
push N (bsearch): 626769.1 i/s - 16.71x slower
|
415
|
+
|
416
|
+
== push N then pop N (N=30000) ================================================
|
417
|
+
Calculating -------------------------------------
|
418
|
+
push N + pop N (bsearch) 1.223M i/s - 1.200M times in 0.981407s (817.84ns/i)
|
419
|
+
push N + pop N (rb_heap) 1.305M i/s - 6.000M times in 4.596226s (766.04ns/i)
|
420
|
+
push N + pop N (c++ stl) 6.965M i/s - 18.000M times in 2.584494s (143.58ns/i, 379clocks/i)
|
421
|
+
push N + pop N (c_dheap) 7.438M i/s - 18.000M times in 2.419970s (134.44ns/i, 271clocks/i)
|
422
|
+
|
423
|
+
Comparison:
|
424
|
+
push N + pop N (c_dheap): 7438108.8 i/s
|
425
|
+
push N + pop N (c++ stl): 6964611.7 i/s - 1.07x slower
|
426
|
+
push N + pop N (rb_heap): 1305418.8 i/s - 5.70x slower
|
427
|
+
push N + pop N (bsearch): 1222734.6 i/s - 6.08x slower
|
428
|
+
|
429
|
+
################################################################################
|
430
|
+
# Benchmarks with N=31,623
|
431
|
+
################################################################################
|
432
|
+
|
433
|
+
== Push/pop with pre-filled queue (size=N) (N=31623) ==========================
|
393
434
|
Warming up --------------------------------------
|
394
|
-
|
395
|
-
|
396
|
-
|
397
|
-
|
435
|
+
push + pop (findmin) 4.101k i/s - 4.296k times in 1.047474s (243.83μs/i)
|
436
|
+
push + pop (bsearch) 1.422M i/s - 1.433M times in 1.007735s (703.26ns/i)
|
437
|
+
push + pop (rb_heap) 808.387k i/s - 842.904k times in 1.042698s (1.24μs/i)
|
438
|
+
push + pop (c++ stl) 4.707M i/s - 4.894M times in 1.039760s (212.47ns/i, 498clocks/i)
|
439
|
+
push + pop (c_dheap) 6.838M i/s - 6.889M times in 1.007490s (146.25ns/i, 383clocks/i)
|
398
440
|
Calculating -------------------------------------
|
399
|
-
|
400
|
-
|
401
|
-
|
402
|
-
|
441
|
+
push + pop (findmin) 4.386k i/s - 12.303k times in 2.805010s (227.99μs/i)
|
442
|
+
push + pop (bsearch) 1.416M i/s - 4.266M times in 3.012567s (706.20ns/i)
|
443
|
+
push + pop (rb_heap) 824.220k i/s - 2.425M times in 2.942372s (1.21μs/i)
|
444
|
+
push + pop (c++ stl) 5.005M i/s - 14.120M times in 2.821127s (199.80ns/i, 408clocks/i)
|
445
|
+
push + pop (c_dheap) 7.584M i/s - 20.513M times in 2.704950s (131.87ns/i, 319clocks/i)
|
403
446
|
|
404
447
|
Comparison:
|
405
|
-
|
406
|
-
|
407
|
-
|
408
|
-
|
448
|
+
push + pop (c_dheap): 7583504.1 i/s
|
449
|
+
push + pop (c++ stl): 5005005.3 i/s - 1.52x slower
|
450
|
+
push + pop (bsearch): 1416019.5 i/s - 5.36x slower
|
451
|
+
push + pop (rb_heap): 824219.7 i/s - 9.20x slower
|
452
|
+
push + pop (findmin): 4386.1 i/s - 1728.99x slower
|
453
|
+
|
454
|
+
################################################################################
|
455
|
+
# Benchmarks with N=100,000
|
456
|
+
################################################################################
|
457
|
+
|
458
|
+
== push N (N=100000) ==========================================================
|
459
|
+
Calculating -------------------------------------
|
460
|
+
push N (findmin) 10.279M i/s - 30.000M times in 2.918590s (97.29ns/i, 244clocks/i)
|
461
|
+
push N (bsearch) 220.832k i/s - 600.000k times in 2.717000s (4.53μs/i)
|
462
|
+
push N (rb_heap) 4.384M i/s - 12.000M times in 2.736961s (228.08ns/i, 561clocks/i)
|
463
|
+
push N (c++ stl) 7.739M i/s - 18.000M times in 2.325853s (129.21ns/i, 317clocks/i)
|
464
|
+
push N (c_dheap) 10.446M i/s - 30.000M times in 2.872022s (95.73ns/i, 170clocks/i)
|
409
465
|
|
410
|
-
|
466
|
+
Comparison:
|
467
|
+
push N (c_dheap): 10445603.0 i/s
|
468
|
+
push N (findmin): 10278935.5 i/s - 1.02x slower
|
469
|
+
push N (c++ stl): 7739095.9 i/s - 1.35x slower
|
470
|
+
push N (rb_heap): 4384424.4 i/s - 2.38x slower
|
471
|
+
push N (bsearch): 220831.8 i/s - 47.30x slower
|
472
|
+
|
473
|
+
== push N then pop N (N=100000) ================================================
|
474
|
+
Calculating -------------------------------------
|
475
|
+
push N + pop N (bsearch) 443.386k i/s - 1.200M times in 2.706446s (2.26μs/i)
|
476
|
+
push N + pop N (rb_heap) 1.174M i/s - 6.000M times in 5.112169s (852.03ns/i)
|
477
|
+
push N + pop N (c++ stl) 6.467M i/s - 18.000M times in 2.783322s (154.63ns/i, 423clocks/i)
|
478
|
+
push N + pop N (c_dheap) 6.772M i/s - 18.000M times in 2.658145s (147.67ns/i, 380clocks/i)
|
479
|
+
|
480
|
+
Comparison:
|
481
|
+
push N + pop N (c_dheap): 6771640.7 i/s
|
482
|
+
push N + pop N (c++ stl): 6467092.5 i/s - 1.05x slower
|
483
|
+
push N + pop N (rb_heap): 1173670.1 i/s - 5.77x slower
|
484
|
+
push N + pop N (bsearch): 443385.9 i/s - 15.27x slower
|
485
|
+
|
486
|
+
== Push/pop with pre-filled queue (size=N) (N=100000) ==========================
|
411
487
|
Warming up --------------------------------------
|
412
|
-
push
|
413
|
-
push
|
414
|
-
push
|
415
|
-
push
|
416
|
-
push
|
417
|
-
Calculating -------------------------------------
|
418
|
-
push
|
419
|
-
push
|
420
|
-
push
|
421
|
-
push
|
422
|
-
push
|
423
|
-
|
424
|
-
Comparison:
|
425
|
-
push
|
426
|
-
push
|
427
|
-
push
|
428
|
-
push
|
429
|
-
push
|
430
|
-
|
431
|
-
|
488
|
+
push + pop (findmin) 1.081k i/s - 1.090k times in 1.008121s (924.88μs/i)
|
489
|
+
push + pop (bsearch) 93.746k i/s - 94.380k times in 1.006760s (10.67μs/i)
|
490
|
+
push + pop (rb_heap) 614.413k i/s - 617.988k times in 1.005818s (1.63μs/i)
|
491
|
+
push + pop (c++ stl) 4.384M i/s - 4.526M times in 1.032424s (228.10ns/i, 367clocks/i)
|
492
|
+
push + pop (c_dheap) 6.357M i/s - 6.395M times in 1.006052s (157.31ns/i, 351clocks/i)
|
493
|
+
Calculating -------------------------------------
|
494
|
+
push + pop (findmin) 1.118k i/s - 3.243k times in 2.901718s (894.76μs/i)
|
495
|
+
push + pop (bsearch) 126.592k i/s - 281.238k times in 2.221611s (7.90μs/i)
|
496
|
+
push + pop (rb_heap) 640.816k i/s - 1.843M times in 2.876396s (1.56μs/i)
|
497
|
+
push + pop (c++ stl) 4.598M i/s - 13.152M times in 2.860115s (217.47ns/i, 548clocks/i)
|
498
|
+
push + pop (c_dheap) 7.040M i/s - 19.070M times in 2.708918s (142.05ns/i, 402clocks/i)
|
499
|
+
|
500
|
+
Comparison:
|
501
|
+
push + pop (c_dheap): 7039813.2 i/s
|
502
|
+
push + pop (c++ stl): 4598367.9 i/s - 1.53x slower
|
503
|
+
push + pop (rb_heap): 640815.8 i/s - 10.99x slower
|
504
|
+
push + pop (bsearch): 126591.9 i/s - 55.61x slower
|
505
|
+
push + pop (findmin): 1117.6 i/s - 6298.97x slower
|
506
|
+
|
507
|
+
################################################################################
|
508
|
+
# Benchmarks with N=300,000
|
509
|
+
################################################################################
|
510
|
+
|
511
|
+
== push N (N=300000) ==========================================================
|
512
|
+
Calculating -------------------------------------
|
513
|
+
push N (findmin) 10.292M i/s - 30.000M times in 2.914849s (97.16ns/i, 216clocks/i)
|
514
|
+
push N (rb_heap) 4.366M i/s - 12.000M times in 2.748236s (229.02ns/i, 508clocks/i)
|
515
|
+
push N (c++ stl) 7.606M i/s - 18.000M times in 2.366608s (131.48ns/i, 237clocks/i)
|
516
|
+
push N (c_dheap) 10.406M i/s - 30.000M times in 2.882976s (96.10ns/i, 239clocks/i)
|
517
|
+
|
518
|
+
Comparison:
|
519
|
+
push N (c_dheap): 10405915.1 i/s
|
520
|
+
push N (findmin): 10292126.6 i/s - 1.01x slower
|
521
|
+
push N (c++ stl): 7605822.4 i/s - 1.37x slower
|
522
|
+
push N (rb_heap): 4366436.9 i/s - 2.38x slower
|
523
|
+
|
524
|
+
== push N then pop N (N=300000) ================================================
|
525
|
+
Calculating -------------------------------------
|
526
|
+
push N + pop N (rb_heap) 1.090M i/s - 6.000M times in 5.503067s (917.18ns/i)
|
527
|
+
push N + pop N (c++ stl) 6.194M i/s - 18.000M times in 2.906249s (161.46ns/i, 397clocks/i)
|
528
|
+
push N + pop N (c_dheap) 5.898M i/s - 18.000M times in 3.051953s (169.55ns/i, 380clocks/i)
|
529
|
+
|
530
|
+
Comparison:
|
531
|
+
push N + pop N (c++ stl): 6193550.8 i/s
|
532
|
+
push N + pop N (c_dheap): 5897862.5 i/s - 1.05x slower
|
533
|
+
push N + pop N (rb_heap): 1090301.2 i/s - 5.68x slower
|
534
|
+
|
535
|
+
################################################################################
|
536
|
+
# Benchmarks with N=316,228
|
537
|
+
################################################################################
|
538
|
+
|
539
|
+
== Push/pop with pre-filled queue (size=N) (N=316228) ==========================
|
432
540
|
Warming up --------------------------------------
|
433
|
-
push + pop (findmin)
|
434
|
-
push + pop (bsearch)
|
435
|
-
push + pop (rb_heap)
|
436
|
-
push + pop (c++ stl)
|
437
|
-
push + pop (c_dheap) 5.
|
541
|
+
push + pop (findmin) 329.363 i/s - 340.000 times in 1.032295s (3.04ms/i)
|
542
|
+
push + pop (bsearch) 26.855k i/s - 27.870k times in 1.037803s (37.24μs/i)
|
543
|
+
push + pop (rb_heap) 510.061k i/s - 516.120k times in 1.011878s (1.96μs/i)
|
544
|
+
push + pop (c++ stl) 3.662M i/s - 3.787M times in 1.034233s (273.07ns/i, 485clocks/i)
|
545
|
+
push + pop (c_dheap) 5.829M i/s - 5.952M times in 1.021078s (171.56ns/i, 409clocks/i)
|
438
546
|
Calculating -------------------------------------
|
439
|
-
push + pop (findmin)
|
440
|
-
push + pop (bsearch)
|
441
|
-
push + pop (rb_heap)
|
442
|
-
push + pop (c++ stl) 4.
|
443
|
-
push + pop (c_dheap) 6.
|
547
|
+
push + pop (findmin) 336.903 i/s - 988.000 times in 2.932592s (2.97ms/i)
|
548
|
+
push + pop (bsearch) 26.374k i/s - 80.564k times in 3.054645s (37.92μs/i)
|
549
|
+
push + pop (rb_heap) 586.229k i/s - 1.530M times in 2.610215s (1.71μs/i)
|
550
|
+
push + pop (c++ stl) 4.199M i/s - 10.986M times in 2.616590s (238.17ns/i, 562clocks/i)
|
551
|
+
push + pop (c_dheap) 6.651M i/s - 17.486M times in 2.628997s (150.35ns/i, 320clocks/i)
|
444
552
|
|
445
553
|
Comparison:
|
446
|
-
push + pop (c_dheap):
|
447
|
-
push + pop (c++ stl):
|
448
|
-
push + pop (
|
449
|
-
push + pop (
|
450
|
-
push + pop (findmin):
|
554
|
+
push + pop (c_dheap): 6651247.1 i/s
|
555
|
+
push + pop (c++ stl): 4198720.4 i/s - 1.58x slower
|
556
|
+
push + pop (rb_heap): 586229.1 i/s - 11.35x slower
|
557
|
+
push + pop (bsearch): 26374.3 i/s - 252.19x slower
|
558
|
+
push + pop (findmin): 336.9 i/s - 19742.30x slower
|
451
559
|
|
452
560
|
################################################################################
|
453
|
-
# Benchmarks with N=
|
561
|
+
# Benchmarks with N=1,000,000
|
454
562
|
################################################################################
|
455
563
|
|
456
|
-
== push N (N=
|
564
|
+
== push N (N=1000000) ==========================================================
|
565
|
+
Calculating -------------------------------------
|
566
|
+
push N (findmin) 9.964M i/s - 30.000M times in 3.010870s (100.36ns/i, 238clocks/i)
|
567
|
+
push N (rb_heap) 4.350M i/s - 12.000M times in 2.758547s (229.88ns/i, 403clocks/i)
|
568
|
+
push N (c++ stl) 7.892M i/s - 18.000M times in 2.280812s (126.71ns/i, 234clocks/i)
|
569
|
+
push N (c_dheap) 10.342M i/s - 30.000M times in 2.900741s (96.69ns/i, 217clocks/i)
|
570
|
+
|
571
|
+
Comparison:
|
572
|
+
push N (c_dheap): 10342183.7 i/s
|
573
|
+
push N (findmin): 9963898.8 i/s - 1.04x slower
|
574
|
+
push N (c++ stl): 7891924.8 i/s - 1.31x slower
|
575
|
+
push N (rb_heap): 4350116.0 i/s - 2.38x slower
|
576
|
+
|
577
|
+
== push N then pop N (N=1000000) ==============================================
|
578
|
+
Calculating -------------------------------------
|
579
|
+
push N + pop N (rb_heap) 976.689k i/s - 6.000M times in 6.143207s (1.02μs/i)
|
580
|
+
push N + pop N (c++ stl) 5.275M i/s - 18.000M times in 3.412544s (189.59ns/i, 371clocks/i)
|
581
|
+
push N + pop N (c_dheap) 4.731M i/s - 18.000M times in 3.804598s (211.37ns/i, 510clocks/i)
|
582
|
+
|
583
|
+
Comparison:
|
584
|
+
push N + pop N (c++ stl): 5274657.5 i/s
|
585
|
+
push N + pop N (c_dheap): 4731117.9 i/s - 1.11x slower
|
586
|
+
push N + pop N (rb_heap): 976688.6 i/s - 5.40x slower
|
587
|
+
|
588
|
+
== Push/pop with pre-filled queue (size=N) (N=1000000) ========================
|
457
589
|
Warming up --------------------------------------
|
458
|
-
|
459
|
-
|
460
|
-
|
461
|
-
|
590
|
+
push + pop (findmin) 133.958 i/s - 140.000 times in 1.045105s (7.47ms/i)
|
591
|
+
push + pop (bsearch) 5.157k i/s - 5.170k times in 1.002466s (193.90μs/i)
|
592
|
+
push + pop (rb_heap) 530.099k i/s - 553.995k times in 1.045078s (1.89μs/i)
|
593
|
+
push + pop (c++ stl) 3.008M i/s - 3.068M times in 1.019941s (332.45ns/i, 961clocks/i)
|
594
|
+
push + pop (c_dheap) 3.792M i/s - 3.850M times in 1.015408s (263.74ns/i, 606clocks/i)
|
595
|
+
Calculating -------------------------------------
|
596
|
+
push + pop (findmin) 133.988 i/s - 401.000 times in 2.992798s (7.46ms/i)
|
597
|
+
push + pop (bsearch) 5.009k i/s - 15.471k times in 3.088774s (199.65μs/i)
|
598
|
+
push + pop (rb_heap) 542.219k i/s - 1.590M times in 2.932944s (1.84μs/i)
|
599
|
+
push + pop (c++ stl) 3.504M i/s - 9.024M times in 2.575239s (285.38ns/i, 601clocks/i)
|
600
|
+
push + pop (c_dheap) 4.702M i/s - 11.375M times in 2.419358s (212.70ns/i, 603clocks/i)
|
601
|
+
|
602
|
+
Comparison:
|
603
|
+
push + pop (c_dheap): 4701505.8 i/s
|
604
|
+
push + pop (c++ stl): 3504115.7 i/s - 1.34x slower
|
605
|
+
push + pop (rb_heap): 542219.0 i/s - 8.67x slower
|
606
|
+
push + pop (bsearch): 5008.8 i/s - 938.65x slower
|
607
|
+
push + pop (findmin): 134.0 i/s - 35088.93x slower
|
608
|
+
|
609
|
+
################################################################################
|
610
|
+
# Benchmarks with N=3,000,000
|
611
|
+
################################################################################
|
612
|
+
|
613
|
+
== push N (N=3000000) ==========================================================
|
614
|
+
Calculating -------------------------------------
|
615
|
+
push N (findmin) 10.061M i/s - 30.000M times in 2.981862s (99.40ns/i, 291clocks/i)
|
616
|
+
push N (rb_heap) 4.332M i/s - 12.000M times in 2.769993s (230.83ns/i, 666clocks/i)
|
617
|
+
push N (c++ stl) 7.700M i/s - 18.000M times in 2.337763s (129.88ns/i, 272clocks/i)
|
618
|
+
push N (c_dheap) 10.306M i/s - 30.000M times in 2.910863s (97.03ns/i, 231clocks/i)
|
619
|
+
|
620
|
+
Comparison:
|
621
|
+
push N (c_dheap): 10306222.6 i/s
|
622
|
+
push N (findmin): 10060827.1 i/s - 1.02x slower
|
623
|
+
push N (c++ stl): 7699668.9 i/s - 1.34x slower
|
624
|
+
push N (rb_heap): 4332141.2 i/s - 2.38x slower
|
625
|
+
|
626
|
+
== push N then pop N (N=3000000) ==============================================
|
462
627
|
Calculating -------------------------------------
|
463
|
-
|
464
|
-
|
465
|
-
|
466
|
-
push N (c_dheap) 115.006 i/s - 687.000 times in 5.973623s (8.70ms/i)
|
628
|
+
push N + pop N (rb_heap) 844.839k i/s - 6.000M times in 7.101946s (1.18μs/i)
|
629
|
+
push N + pop N (c++ stl) 4.417M i/s - 18.000M times in 4.075439s (226.41ns/i, 576clocks/i)
|
630
|
+
push N + pop N (c_dheap) 4.006M i/s - 18.000M times in 4.493805s (249.66ns/i, 359clocks/i)
|
467
631
|
|
468
632
|
Comparison:
|
469
|
-
|
470
|
-
|
471
|
-
|
472
|
-
|
633
|
+
push N + pop N (c++ stl): 4416702.3 i/s
|
634
|
+
push N + pop N (c_dheap): 4005514.5 i/s - 1.10x slower
|
635
|
+
push N + pop N (rb_heap): 844838.9 i/s - 5.23x slower
|
636
|
+
|
637
|
+
################################################################################
|
638
|
+
# Benchmarks with N=3,162,278
|
639
|
+
################################################################################
|
473
640
|
|
474
|
-
==
|
641
|
+
== Push/pop with pre-filled queue (size=N) (N=3162278) ========================
|
475
642
|
Warming up --------------------------------------
|
476
|
-
push
|
477
|
-
push
|
478
|
-
push
|
479
|
-
push
|
480
|
-
push
|
481
|
-
Calculating -------------------------------------
|
482
|
-
push
|
483
|
-
push
|
484
|
-
push
|
485
|
-
push
|
486
|
-
push
|
487
|
-
|
488
|
-
Comparison:
|
489
|
-
push
|
490
|
-
push
|
491
|
-
push
|
492
|
-
push
|
493
|
-
push
|
494
|
-
|
495
|
-
|
643
|
+
push + pop (findmin) 40.806 i/s - 45.000 times in 1.102775s (24.51ms/i)
|
644
|
+
push + pop (bsearch) 959.453 i/s - 968.000 times in 1.008908s (1.04ms/i)
|
645
|
+
push + pop (rb_heap) 465.404k i/s - 502.801k times in 1.080353s (2.15μs/i)
|
646
|
+
push + pop (c++ stl) 2.153M i/s - 2.167M times in 1.006608s (464.52ns/i)
|
647
|
+
push + pop (c_dheap) 2.301M i/s - 2.320M times in 1.007969s (434.52ns/i, 912clocks/i)
|
648
|
+
Calculating -------------------------------------
|
649
|
+
push + pop (findmin) 41.611 i/s - 122.000 times in 2.931911s (24.03ms/i)
|
650
|
+
push + pop (bsearch) 984.072 i/s - 2.878k times in 2.924583s (1.02ms/i)
|
651
|
+
push + pop (rb_heap) 463.971k i/s - 1.396M times in 3.009265s (2.16μs/i)
|
652
|
+
push + pop (c++ stl) 2.514M i/s - 6.458M times in 2.569153s (397.81ns/i, 749clocks/i)
|
653
|
+
push + pop (c_dheap) 2.845M i/s - 6.904M times in 2.426969s (351.52ns/i)
|
654
|
+
|
655
|
+
Comparison:
|
656
|
+
push + pop (c_dheap): 2844751.4 i/s
|
657
|
+
push + pop (c++ stl): 2513767.5 i/s - 1.13x slower
|
658
|
+
push + pop (rb_heap): 463971.4 i/s - 6.13x slower
|
659
|
+
push + pop (bsearch): 984.1 i/s - 2890.80x slower
|
660
|
+
push + pop (findmin): 41.6 i/s - 68365.22x slower
|
661
|
+
|
662
|
+
################################################################################
|
663
|
+
# Benchmarks with N=10,000,000
|
664
|
+
################################################################################
|
665
|
+
|
666
|
+
== Push/pop with pre-filled queue (size=N) (N=10000000) ========================
|
496
667
|
Warming up --------------------------------------
|
497
|
-
push + pop (findmin)
|
498
|
-
push + pop (bsearch)
|
499
|
-
push + pop (rb_heap)
|
500
|
-
push + pop (c++ stl)
|
501
|
-
push + pop (c_dheap)
|
502
|
-
Calculating -------------------------------------
|
503
|
-
push + pop (findmin)
|
504
|
-
push + pop (bsearch)
|
505
|
-
push + pop (rb_heap)
|
506
|
-
push + pop (c++ stl)
|
507
|
-
push + pop (c_dheap)
|
508
|
-
|
509
|
-
Comparison:
|
510
|
-
push + pop (
|
511
|
-
push + pop (
|
512
|
-
push + pop (rb_heap):
|
513
|
-
push + pop (bsearch):
|
514
|
-
push + pop (findmin):
|
668
|
+
push + pop (findmin) 12.805 i/s - 14.000 times in 1.093356s (78.10ms/i)
|
669
|
+
push + pop (bsearch) 286.818 i/s - 308.000 times in 1.073852s (3.49ms/i)
|
670
|
+
push + pop (rb_heap) 450.346k i/s - 452.478k times in 1.004734s (2.22μs/i)
|
671
|
+
push + pop (c++ stl) 1.816M i/s - 1.816M times in 0.999712s (550.55ns/i)
|
672
|
+
push + pop (c_dheap) 1.720M i/s - 1.725M times in 1.002939s (581.52ns/i)
|
673
|
+
Calculating -------------------------------------
|
674
|
+
push + pop (findmin) 12.962 i/s - 38.000 times in 2.931734s (77.15ms/i)
|
675
|
+
push + pop (bsearch) 315.781 i/s - 860.000 times in 2.723405s (3.17ms/i)
|
676
|
+
push + pop (rb_heap) 445.131k i/s - 1.351M times in 3.035144s (2.25μs/i)
|
677
|
+
push + pop (c++ stl) 1.962M i/s - 5.449M times in 2.777382s (509.70ns/i)
|
678
|
+
push + pop (c_dheap) 1.916M i/s - 5.159M times in 2.692582s (521.93ns/i)
|
679
|
+
|
680
|
+
Comparison:
|
681
|
+
push + pop (c++ stl): 1961952.2 i/s
|
682
|
+
push + pop (c_dheap): 1915981.2 i/s - 1.02x slower
|
683
|
+
push + pop (rb_heap): 445131.4 i/s - 4.41x slower
|
684
|
+
push + pop (bsearch): 315.8 i/s - 6213.01x slower
|
685
|
+
push + pop (findmin): 13.0 i/s - 151366.37x slower
|
515
686
|
|