README.md in pairing_heap-3.0.1 vs README.md in pairing_heap-3.1.0
- old
+ new
@@ -99,13 +99,16 @@
| enqueue | O(1) | O(1) |
| peek | O(1) | O(1) |
| dequeue | O(n) | O(log n) |
| * change_priority | O(1) | o(log n) |
| * delete | O(n) | O(log n) |
+| ^ merge | O(1) | O(1) |
`*` Not available in `SimplePairingHeap`
+`^` Only available in `SimplePairingHeap`
+
## Benchmarks
I picked the three fastest pure Ruby priority queue implementations I was aware of for the comparison:
* [lazy_priority_queue](https://github.com/matiasbattocchia/lazy_priority_queue) that uses a lazy binomial heap. This is probably the most popular option. It was used in [RGL](https://github.com/monora/rgl/) until PairingHeap replaced it.
* Pure Ruby implementation of Fibonacci Heap from [priority-queue](https://github.com/supertinou/priority-queue) ([link to source](https://github.com/supertinou/priority-queue/blob/master/lib/priority_queue/ruby_priority_queue.rb))
@@ -115,673 +118,561 @@
### Stress test without changing priority test(N = 1000) [source code](./test/performance.rb)
Original performance test from [lazy_priority_queue](https://github.com/matiasbattocchia/lazy_priority_queue)
> A stress test of 1,000,000 operations: starting with 1,000 pushes/0 pops, following 999 pushes/1 pop, and so on till 0 pushes/1000 pops.
<table>
<tr>
- <th colspan="4">ruby 3.1.2p20 (2022-04-12 revision 4491bb740a) [x86_64-darwin21]</th>
+ <th colspan="4">ruby 3.3.0 (2023-12-25 revision 5124f9ac75) [x86_64-darwin23]</th>
</tr>
<tr>
<th>Library</th>
<th>Iterations</th>
<th>Seconds</th>
<th>Iterations per second</th>
</tr>
<tr>
<td>pairing_heap (SimplePairingHeap)</td>
- <td>23</td>
- <td>62.014773</td>
- <td>0.371</td>
+ <td>26</td>
+ <td>62.249427</td>
+ <td>0.419</td>
</tr>
<tr>
<td>pairing_heap (PairingHeap)</td>
- <td>16</td>
- <td>63.135240</td>
- <td>0.253(1.46x slower)</td>
+ <td>17</td>
+ <td>61.624806</td>
+ <td>0.276(1.52x slower)</td>
</tr>
<tr>
<td>rb_heap</td>
- <td>14</td>
- <td>61.123304</td>
- <td>0.229(1.62x slower)</td>
+ <td>16</td>
+ <td>63.656502</td>
+ <td>0.251(1.67x slower)</td>
</tr>
<tr>
<td>lazy_priority_queue</td>
- <td>10</td>
- <td>66.208647</td>
- <td>0.151(2.46x slower)</td>
+ <td>7</td>
+ <td>63.339192</td>
+ <td>0.111(3.79x slower)</td>
</tr>
<tr>
<td>Fibonacci</td>
- <td>8</td>
- <td>66.353147</td>
- <td>0.121(3.08x slower)</td>
+ <td>5</td>
+ <td>69.010737</td>
+ <td>0.073(5.77x slower)</td>
</tr>
<tr>
- <th colspan="4">ruby 3.1.2p20 (2022-04-12 revision 4491bb740a) +YJIT [x86_64-darwin21]</th>
+ <th colspan="4">ruby 3.3.0 (2023-12-25 revision 5124f9ac75) +YJIT [x86_64-darwin23]</th>
</tr>
<tr>
<th>Library</th>
<th>Iterations</th>
<th>Seconds</th>
<th>Iterations per second</th>
</tr>
<tr>
<td>pairing_heap (SimplePairingHeap)</td>
- <td>25</td>
- <td>60.423579</td>
- <td>0.414</td>
+ <td>39</td>
+ <td>60.725689</td>
+ <td>0.642</td>
</tr>
<tr>
<td>rb_heap</td>
- <td>19</td>
- <td>60.869907</td>
- <td>0.312(1.33x slower)</td>
+ <td>31</td>
+ <td>60.370348</td>
+ <td>0.514(1.25x slower)</td>
</tr>
<tr>
<td>pairing_heap (PairingHeap)</td>
- <td>17</td>
- <td>61.389127</td>
- <td>0.277(1.49x slower)</td>
+ <td>25</td>
+ <td>62.269577</td>
+ <td>0.402(1.6x slower)</td>
</tr>
<tr>
- <td>Fibonacci</td>
- <td>14</td>
- <td>64.417807</td>
- <td>0.217(1.90x slower)</td>
+ <td>lazy_priority_queue</td>
+ <td>9</td>
+ <td>62.144710</td>
+ <td>0.145(4.43x slower)</td>
</tr>
<tr>
- <td>lazy_priority_queue</td>
- <td>11</td>
- <td>63.151856</td>
- <td>0.174(2.38x slower)</td>
+ <td>Fibonacci</td>
+ <td>8</td>
+ <td>65.064385</td>
+ <td>0.123(5.22x slower)</td>
</tr>
<tr>
- <th colspan="4">jruby 9.3.7.0 (2.6.8) 2022-08-16 c79ef237e0 OpenJDK 64-Bit Server VM 17.0.2+8-86 on 17.0.2+8-86 +indy +jit [x86_64-darwin]</th>
+ <th colspan="4">jruby 9.4.5.0 (3.1.4) 2023-11-02 1abae2700f OpenJDK 64-Bit Server VM 21+35-2513 on 21+35-2513 +indy +jit [x86_64-darwin]</th>
</tr>
<tr>
<th>Library</th>
<th>Iterations</th>
<th>Seconds</th>
<th>Iterations per second</th>
</tr>
<tr>
<td>pairing_heap (SimplePairingHeap)</td>
- <td>47</td>
- <td>60.391633</td>
- <td>0.778</td>
+ <td>43</td>
+ <td>60.734661</td>
+ <td>0.709</td>
</tr>
<tr>
<td>rb_heap</td>
<td>34</td>
- <td>60.878639</td>
- <td>0.559(1.39x slower)</td>
+ <td>61.677228</td>
+ <td>0.552(1.28x slower)</td>
</tr>
<tr>
<td>pairing_heap (PairingHeap)</td>
- <td>32</td>
- <td>61.211985</td>
- <td>0.523(1.49x slower)</td>
+ <td>28</td>
+ <td>61.284382</td>
+ <td>0.458(1.55x slower)</td>
</tr>
<tr>
<td>Fibonacci</td>
- <td>23</td>
- <td>60.297670</td>
- <td>0.382(2.04x slower)</td>
+ <td>22</td>
+ <td>61.396897</td>
+ <td>0.359(1.97x slower)</td>
</tr>
<tr>
<td>lazy_priority_queue</td>
- <td>23</td>
- <td>61.973538</td>
- <td>0.371(2.10x slower)</td>
+ <td>20</td>
+ <td>61.841463</td>
+ <td>0.324(2.19x slower)</td>
</tr>
<tr>
- <th colspan="4">truffleruby 22.2.0, like ruby 3.0.3, GraalVM CE JVM [x86_64-darwin]</th>
+ <th colspan="4">truffleruby 23.1.2, like ruby 3.2.2, Oracle GraalVM JVM [x86_64-darwin]</th>
</tr>
<tr>
<th>Library</th>
<th>Iterations</th>
<th>Seconds</th>
<th>Iterations per second</th>
</tr>
<tr>
<td>pairing_heap (SimplePairingHeap)</td>
- <td>206</td>
- <td>60.191686</td>
- <td>3.433</td>
+ <td>202</td>
+ <td>60.225639</td>
+ <td>3.388</td>
</tr>
<tr>
<td>rb_heap</td>
- <td>97</td>
- <td>60.134011</td>
- <td>1.614(1.93x slower)</td>
+ <td>140</td>
+ <td>60.190881</td>
+ <td>2.357(1.44x slower)</td>
</tr>
<tr>
<td>pairing_heap (PairingHeap)</td>
- <td>85</td>
- <td>60.193608s</td>
- <td>1.434(2.40x slower)</td>
+ <td>100</td>
+ <td>60.373610</td>
+ <td>1.692(2x slower)</td>
</tr>
<tr>
<td>lazy_priority_queue</td>
- <td>19</td>
- <td>63.212429</td>
- <td>0.301(11.45x slower)</td>
+ <td>31</td>
+ <td>61.179244</td>
+ <td>0.510(6.65x slower)</td>
</tr>
<tr>
<td>Fibonacci</td>
- <td>2</td>
- <td>83.508571</td>
- <td>0.024(143.70x slower)</td>
+ <td>11</td>
+ <td>64.413419</td>
+ <td>0.171(19.81x slower)</td>
</tr>
</table>
### Stress test with changing priority(N = 1000) [source code](./test/performance_with_change_priority.rb)
A stress test of 1,501,500 operations: starting with 1,000 pushes/1000 change_priorities/0 pops, following 999 pushes/999 change_priorities/1 pop, and so on till 0 pushes/0 change_priorities/1000 pops.
<table>
<tr>
- <th colspan="4">ruby 3.1.2p20 (2022-04-12 revision 4491bb740a) [x86_64-darwin21]</th>
+ <th colspan="4">ruby 3.3.0 (2023-12-25 revision 5124f9ac75) [x86_64-darwin23]</th>
</tr>
<tr>
<th>Library</th>
<th>Iterations</th>
<th>Seconds</th>
<th>Iterations per second</th>
</tr>
<tr>
<td>pairing_heap</td>
<td>15</td>
- <td>62.946988</td>
- <td>0.238</td>
+ <td>60.817878</td>
+ <td>0.247</td>
</tr>
<tr>
<td>lazy_priority_queue</td>
- <td>9</td>
- <td>61.876691</td>
- <td>0.145(1.64x slower)</td>
+ <td>7</td>
+ <td>63.990376s</td>
+ <td>0.109(2.26x slower)</td>
</tr>
<tr>
<td>Fibonacci</td>
- <td>8</td>
- <td>67.809982</td>
- <td>0.118(2.02x slower)</td>
+ <td>5</td>
+ <td>70.148980s</td>
+ <td>0.071(3.47x slower)</td>
</tr>
<tr>
- <th colspan="4">ruby 3.1.2p20 (2022-04-12 revision 4491bb740a) +YJIT [x86_64-darwin21]</th>
+ <th colspan="4">ruby 3.3.0 (2023-12-25 revision 5124f9ac75) +YJIT [x86_64-darwin23]</th>
</tr>
<tr>
<th>Library</th>
<th>Iterations</th>
<th>Seconds</th>
<th>Iterations per second</th>
</tr>
<tr>
<td>pairing_heap</td>
- <td>16</td>
- <td>62.576693</td>
- <td>0.256</td>
+ <td>22</td>
+ <td>62.429264</td>
+ <td>0.353</td>
</tr>
<tr>
- <td>Fibonacci</td>
- <td>13</td>
- <td>63.164614</td>
- <td>0.206(1.24x slower)</td>
+ <td>lazy_priority_queue</td>
+ <td>9</td>
+ <td>63.464818</td>
+ <td>0.142(2.49x slower)</td>
</tr>
<tr>
- <td>lazy_priority_queue</td>
- <td>10</td>
- <td>63.172995s</td>
- <td>0.158(1.62x slower)</td>
+ <td>Fibonacci</td>
+ <td>8</td>
+ <td>67.908812</td>
+ <td>0.118(2.99x slower)</td>
</tr>
<tr>
- <th colspan="4">jruby 9.3.7.0 (2.6.8) 2022-08-16 c79ef237e0 OpenJDK 64-Bit Server VM 17.0.2+8-86 on 17.0.2+8-86 +indy +jit [x86_64-darwin]</th>
+ <th colspan="4">jruby 9.4.5.0 (3.1.4) 2023-11-02 1abae2700f OpenJDK 64-Bit Server VM 21+35-2513 on 21+35-2513 +indy +jit [x86_64-darwin]</th>
</tr>
<tr>
<th>Library</th>
<th>Iterations</th>
<th>Seconds</th>
<th>Iterations per second</th>
</tr>
<tr>
<td>pairing_heap</td>
- <td>28</td>
- <td>60.280368</td>
- <td>0.465</td>
+ <td>27</td>
+ <td>61.709517</td>
+ <td>0.438</td>
</tr>
<tr>
<td>Fibonacci</td>
- <td>22</td>
- <td>61.405561</td>
- <td>0.465(1.30x slower)</td>
+ <td>20</td>
+ <td>61.495636</td>
+ <td>0.326(1.34x slower)</td>
</tr>
<tr>
<td>lazy_priority_queue</td>
- <td>20</td>
- <td>60.397535</td>
- <td>0.331(1.40x slower)</td>
+ <td>19</td>
+ <td>63.401601</td>
+ <td>0.309(1.46x slower)</td>
</tr>
<tr>
- <th colspan="4">truffleruby 22.2.0, like ruby 3.0.3, GraalVM CE JVM [x86_64-darwin]</th>
+ <th colspan="4">truffleruby 23.1.2, like ruby 3.2.2, Oracle GraalVM JVM [x86_64-darwin]</th>
</tr>
<tr>
<th>Library</th>
<th>Iterations</th>
<th>Seconds</th>
<th>Iterations per second</th>
</tr>
<tr>
<td>pairing_heap</td>
- <td>70</td>
- <td>60.663184</td>
- <td>1.160</td>
+ <td>93</td>
+ <td>60.125750</td>
+ <td>1.577</td>
</tr>
<tr>
<td>lazy_priority_queue</td>
- <td>23</td>
- <td>60.474587</td>
- <td>0.382(3.04x slower)</td>
+ <td>26</td>
+ <td>62.372660s</td>
+ <td>0.419(3.77x slower)</td>
</tr>
<tr>
<td>Fibonacci</td>
- <td>2</td>
- <td>74.873854</td>
- <td>0.027(43.44x slower)</td>
+ <td>11</td>
+ <td>62.620172s</td>
+ <td>0.177(8.92x slower)</td>
</tr>
</table>
### Stress test with changing priority or push/pop(test ignored in summary) [source code](./test/performance_pop_versus_change_priority.rb)
Start with 500 pushes, then:
* If queue supports changing priority 500 change_priority calls, then 500 pops
* If does not support changing priority 500 push calls, then 1000 pops
<table>
<tr>
- <th colspan="4">ruby 3.1.2p20 (2022-04-12 revision 4491bb740a) [x86_64-darwin21]</th>
+ <th colspan="4">ruby 3.3.0 (2023-12-25 revision 5124f9ac75) [x86_64-darwin23]</th>
</tr>
<tr>
<th>Library</th>
<th>Iterations per second</th>
</tr>
<tr>
<td>pairing_heap (PairingHeap)</td>
- <td>436.4</td>
+ <td>748.9</td>
</tr>
<tr>
<td>lazy_priority_queue</td>
- <td>380.2(1.94x slower)</td>
+ <td>388.6(1.93x slower)</td>
</tr>
<tr>
<td>pairing_heap (SimplePairingHeap)</td>
- <td>339.9.02(2.17x slower)</td>
+ <td>336.2(2.23x slower)</td>
</tr>
<tr>
<td>Fibonacci</td>
- <td>313.9(2.35x slower)</td>
+ <td>225.9(3.31x slower)</td>
</tr>
<tr>
<td>rb_heap</td>
- <td>194.7(3.78 slower)</td>
+ <td>215.2(3.48x slower)</td>
</tr>
<tr>
- <th colspan="4">ruby 3.1.2p20 (2022-04-12 revision 4491bb740a) +YJIT [x86_64-darwin21]</th>
+ <th colspan="4">ruby 3.3.0 (2023-12-25 revision 5124f9ac75) +YJIT [x86_64-darwin23]</th>
</tr>
<tr>
<th>Library</th>
<th>Iterations per second</th>
</tr>
<tr>
<td>pairing_heap</td>
- <td>854.6</td>
+ <td>1276</td>
</tr>
<tr>
- <td>Fibonacci</td>
- <td>651.3(1.31x slower)</td>
+ <td>pairing_heap(SimplePairingHeap)</td>
+ <td>625.6(2.04x slower)</td>
</tr>
<tr>
<td>lazy_priority_queue</td>
- <td>453.6(1.88x slower)</td>
+ <td>533.36(2.39x slower)</td>
</tr>
<tr>
- <td>pairing_heap(SimplePairingHeap)</td>
- <td>390.9(2.19x slower)</td>
+ <td>Fibonacci</td>
+ <td>495.519(2.57x slower)</td>
</tr>
<tr>
<td>rb_heap</td>
- <td>268.8(3.18x slower)</td>
+ <td>453.323(2.81x slower)</td>
</tr>
<tr>
- <th colspan="4">jruby 9.3.7.0 (2.6.8) 2022-08-16 c79ef237e0 OpenJDK 64-Bit Server VM 17.0.2+8-86 on 17.0.2+8-86 +indy +jit [x86_64-darwin]</th>
+ <th colspan="4">jruby 9.4.5.0 (3.1.4) 2023-11-02 1abae2700f OpenJDK 64-Bit Server VM 21+35-2513 on 21+35-2513 +indy +jit [x86_64-darwin]</th>
</tr>
<tr>
<th>Library</th>
<th>Iterations per second</th>
</tr>
<tr>
<td>pairing_heap(PairingHeap)</td>
- <td>1591</td>
+ <td>1377</td>
</tr>
<tr>
<td>Fibonacci</td>
- <td>1092(1.46x slower)</td>
+ <td>1088(1.27x slower)</td>
</tr>
<tr>
<td>lazy_priority_queue</td>
- <td>986(1.61x slower)</td>
+ <td>953.935(1.44x slower)</td>
</tr>
<tr>
<td>pairing_heap(SimplePairingHeap)</td>
- <td>562(2.37x slower)</td>
+ <td>621.35(2.22x slower)</td>
</tr>
<tr>
<td>rb_heap</td>
- <td>623(2.55x slower)</td>
+ <td>595.11(2.31x slower)</td>
</tr>
<tr>
- <th colspan="4">truffleruby 22.2.0, like ruby 3.0.3, GraalVM CE JVM [x86_64-darwin]</th>
+ <th colspan="4">truffleruby 23.1.2, like ruby 3.2.2, Oracle GraalVM JVM [x86_64-darwin]</th>
</tr>
<tr>
<th>Library</th>
<th>Iterations per second</th>
</tr>
<tr>
<td>pairing_heap(PairingHeap)</td>
- <td>7404</td>
+ <td>12712</td>
</tr>
<tr>
<td>pairing_heap(SimplePairingHeap)</td>
- <td>5104(1.45x slower)</td>
+ <td>9447(1.35x slower)</td>
</tr>
<tr>
<td>rb_heap</td>
- <td>1575(4.70x slower)</td>
+ <td>4009(3.17x slower)</td>
</tr>
<tr>
<td>Fibonacci</td>
- <td>1258(5.88x slower)</td>
+ <td>2793(4.55x slower)</td>
</tr>
<tr>
<td>lazy_priority_queue</td>
- <td>1004(7.38x slower)</td>
+ <td>1188(10.7x slower)</td>
</tr>
</table>
-### Dijkstra's algorithm with RGL [source code](./test/performance_rgl.rb)
-<table>
- <tr>
- <th colspan="4">ruby 3.1.2p20 (2022-04-12 revision 4491bb740a) [x86_64-darwin21]</th>
- </tr>
- <tr>
- <th>Library</th>
- <th>Iterations</th>
- <th>Seconds</th>
- <th>Iterations per second</th>
- </tr>
- <tr>
- <td>pairing_heap</td>
- <td>9</td>
- <td>61.469343</td>
- <td>0.116</td>
- </tr>
- <tr>
- <td>lazy_priority_queue</td>
- <td>8</td>
- <td>64.312672</td>
- <td>0.125(1.18x slower)</td>
- </tr>
- <tr>
- <td>Fibonacci</td>
- <td>7</td>
- <td>60.555716</td>
- <td>0.116(1.27x slower)</td>
- </tr>
- <tr>
- <th colspan="4">ruby 3.1.2p20 (2022-04-12 revision 4491bb740a) +YJIT [x86_64-darwin21]</th>
- </tr>
- <tr>
- <th>Library</th>
- <th>Iterations</th>
- <th>Seconds</th>
- <th>Iterations per second</th>
- </tr>
- <tr>
- <td>pairing_heap</td>
- <td>10</td>
- <td>65.160945s</td>
- <td>0.154</td>
- </tr>
- <tr>
- <td>Fibonacci</td>
- <td>9</td>
- <td>61.950587</td>
- <td>0.145(1.06x slower)</td>
- </tr>
- <tr>
- <td>lazy_priority_queue</td>
- <td>9</td>
- <td>66.592123</td>
- <td>0.135(1.14x slower)</td>
- </tr>
- <tr>
- <th colspan="4">jruby 9.3.7.0 (2.6.8) 2022-08-16 c79ef237e0 OpenJDK 64-Bit Server VM 17.0.2+8-86 on 17.0.2+8-86 +indy +jit [x86_64-darwin]</th>
- </tr>
- <tr>
- <th>Library</th>
- <th>Iterations</th>
- <th>Seconds</th>
- <th>Iterations per second</th>
- </tr>
- <tr>
- <td>lazy_priority_queue</td>
- <td>20</td>
- <td>61.149944</td>
- <td>0.328</td>
- </tr>
- <tr>
- <td>pairing_heap</td>
- <td>20</td>
- <td>61.210225s</td>
- <td>0.328</td>
- </tr>
- <tr>
- <td>Fibonacci</td>
- <td>18</td>
- <td>62.330882</td>
- <td>0.292(1.12x slower)</td>
- </tr>
- <tr>
- <th colspan="4">truffleruby 22.2.0, like ruby 3.0.3, GraalVM CE JVM [x86_64-darwin]</th>
- </tr>
- <tr>
- <th>Library</th>
- <th>Iterations</th>
- <th>Seconds</th>
- <th>Iterations per second</th>
- </tr>
- <tr>
- <td>pairing_heap</td>
- <td>59</td>
- <td>60.053843</td>
- <td>0.991</td>
- </tr>
- <tr>
- <td>lazy_priority_queue</td>
- <td>34</td>
- <td>60.586461</td>
- <td>0.563(1.76x slower)</td>
- </tr>
- <tr>
- <td>Fibonacci</td>
- <td>31</td>
- <td>60.633711</td>
- <td>0.520(1.90x slower)</td>
- </tr>
-</table>
-
### Simple Dijkstra's algorithm implementation [source code](./test/performance_dijkstra.rb)
Heaps that support change_priority operation use it. Heaps that do not support it use dijkstra implementation that do not rely on change_priority instead and do additional pops and pushes instead(see Dijkstra-NoDec from [Priority Queues and Dijkstra’s Algorithm](https://www3.cs.stonybrook.edu/~rezaul/papers/TR-07-54.pdf)).
<table>
<tr>
- <th colspan="4">ruby 3.1.2p20 (2022-04-12 revision 4491bb740a) [x86_64-darwin21]</th>
+ <th colspan="4">ruby 3.3.0 (2023-12-25 revision 5124f9ac75) [x86_64-darwin23]</th>
</tr>
<tr>
<th>Library</th>
<th>Iterations</th>
<th>Seconds</th>
<th>Iterations per second</th>
</tr>
<tr>
<td>pairing_heap (SimplePairingHeap)</td>
- <td>28</td>
- <td>62.100299</td>
- <td>0.451</td>
+ <td>41</td>
+ <td>60.100316</td>
+ <td>0.682</td>
</tr>
<tr>
<td>pairing_heap (PairingHeap)</td>
- <td>23</td>
- <td>60.633153</td>
- <td>0.380(1.19x slower)</td>
+ <td>38</td>
+ <td>61.003607</td>
+ <td>0.623(1.09x slower)</td>
</tr>
<tr>
<td>rb_heap</td>
- <td>14</td>
- <td>62.019763</td>
- <td>0.226(2.00x slower)</td>
+ <td>30</td>
+ <td>61.486216</td>
+ <td>0.488(1.40x slower)</td>
</tr>
<tr>
<td>lazy_priority_queue</td>
- <td>11</td>
- <td>63.105064s</td>
- <td>0.174(2.58x slower)</td>
+ <td>23</td>
+ <td>60.251764</td>
+ <td>0.382(1.79x slower)</td>
</tr>
<tr>
<td>Fibonacci</td>
- <td>10</td>
- <td>64.407187</td>
- <td>0.155(2.90x slower)</td>
+ <td>13</td>
+ <td>61.158622</td>
+ <td>0.213(3.21x slower)</td>
</tr>
<tr>
- <th colspan="4">ruby 3.1.2p20 (2022-04-12 revision 4491bb740a) +YJIT [x86_64-darwin21]</th>
+ <th colspan="4">ruby 3.3.0 (2023-12-25 revision 5124f9ac75) +YJIT [x86_64-darwin23]</th>
</tr>
<tr>
<th>Library</th>
<th>Iterations</th>
<th>Seconds</th>
<th>Iterations per second</th>
</tr>
<tr>
<td>pairing_heap (SimplePairingHeap)</td>
- <td>32</td>
- <td>61.289321</td>
- <td>0.522</td>
+ <td>65</td>
+ <td>60.805882</td>
+ <td>1.070</td>
</tr>
<tr>
<td>pairing_heap (PairingHeap)</td>
- <td>26</td>
- <td>60.657625</td>
- <td>0.429(1.22x slower)</td>
+ <td>60</td>
+ <td>60.790842</td>
+ <td>0.987(1.08x slower)</td>
</tr>
<tr>
<td>rb_heap</td>
- <td>19</td>
- <td>60.710888s</td>
- <td>0.313(1.67x slower)</td>
+ <td>54</td>
+ <td>60.917679</td>
+ <td>0.887(1.21x slower)</td>
</tr>
<tr>
- <td>Fibonacci</td>
- <td>19</td>
- <td>61.471203</td>
- <td>0.310(1.69x slower)</td>
+ <td>lazy_priority_queue</td>
+ <td>30</td>
+ <td>60.712786</td>
+ <td>0.495(2.16x slower)</td>
</tr>
<tr>
- <td>lazy_priority_queue</td>
- <td>12</td>
- <td>60.125779</td>
- <td>0.200(2.61x slower)</td>
+ <td>Fibonacci</td>
+ <td>24</td>
+ <td>61.900715</td>
+ <td>0.388(2.76x slower)</td>
</tr>
<tr>
- <th colspan="4">jruby 9.3.7.0 (2.6.8) 2022-08-16 c79ef237e0 OpenJDK 64-Bit Server VM 17.0.2+8-86 on 17.0.2+8-86 +indy +jit [x86_64-darwin]</th>
+ <th colspan="4">jruby 9.4.5.0 (3.1.4) 2023-11-02 1abae2700f OpenJDK 64-Bit Server VM 21+35-2513 on 21+35-2513 +indy +jit [x86_64-darwin]</th>
</tr>
<tr>
<th>Library</th>
<th>Iterations</th>
<th>Seconds</th>
<th>Iterations per second</th>
</tr>
<tr>
- <td>pairing_heap (SimplePairingHeap)</td>
- <td>46</td>
- <td>61.226924</td>
- <td>0.753</td>
+ <td>rb_heap</td>
+ <td>70</td>
+ <td>60.077928</td>
+ <td>1.168</td>
</tr>
<tr>
- <td>rb_heap</td>
- <td>38</td>
- <td>60.563995</td>
- <td>0.628(1.20x slower)</td>
+ <td>pairing_heap (SimplePairingHeap)</td>
+ <td>66</td>
+ <td>60.420935</td>
+ <td>1.094(1.07x slower)</td>
</tr>
<tr>
<td>pairing_heap (PairingHeap)</td>
- <td>37</td>
- <td>60.928350</td>
- <td>0.608(1.24x slower)</td>
+ <td>64</td>
+ <td>60.114467</td>
+ <td>1.066(1.1x slower)</td>
</tr>
<tr>
<td>Fibonacci</td>
- <td>28</td>
- <td>61.136970</td>
- <td>0.461(1.63x slower)</td>
+ <td>54</td>
+ <td>60.426971</td>
+ <td>0.898(1.30x slower)</td>
</tr>
<tr>
<td>lazy_priority_queue</td>
- <td>22</td>
- <td>62.214796</td>
- <td>0.354(2.13x slower)</td>
+ <td>49</td>
+ <td>60.636963</td>
+ <td>0.809(1.44x slower)</td>
</tr>
<tr>
- <th colspan="4">truffleruby 22.2.0, like ruby 3.0.3, GraalVM CE JVM [x86_64-darwin]</th>
+ <th colspan="4">truffleruby 23.1.2, like ruby 3.2.2, Oracle GraalVM JVM [x86_64-darwin]</th>
</tr>
<tr>
<th>Library</th>
<th>Iterations</th>
<th>Seconds</th>
<th>Iterations per second</th>
</tr>
<tr>
<td>pairing_heap (SimplePairingHeap)</td>
- <td>176</td>
- <td>60.029817</td>
- <td>3.006</td>
+ <td>288</td>
+ <td>60.102278</td>
+ <td>4.936</td>
</tr>
<tr>
<td>pairing_heap (PairingHeap)</td>
- <td>124</td>
- <td>60.366607</td>
- <td>2.078(1.45x slower)</td>
+ <td>232</td>
+ <td>60.159057</td>
+ <td>3.936(1.25x slower)</td>
</tr>
<tr>
<td>rb_heap</td>
- <td>95</td>
- <td>60.021043</td>
- <td>1.585(1.90x slower)</td>
+ <td>227</td>
+ <td>60.082482</td>
+ <td>3.881(1.27x slower)</td>
</tr>
<tr>
<td>Fibonacci</td>
- <td>38</td>
- <td>60.020976</td>
- <td>0.636(4.72x slower)</td>
+ <td>101</td>
+ <td>60.076691</td>
+ <td>1.721(2.87x slower)</td>
</tr>
<tr>
<td>lazy_priority_queue</td>
- <td>27</td>
- <td>61.349925</td>
- <td>0.445(6.75x slower)</td>
+ <td>66</td>
+ <td>60.771569</td>
+ <td>1.1(4.49x slower)</td>
</tr>
</table>
### Summary
#### Change priority required
<table>
<tr>
- <th colspan="4">ruby 3.1.2p20 (2022-04-12 revision 4491bb740a) [x86_64-darwin21]</th>
+ <th colspan="4">ruby 3.3.0 (2023-12-25 revision 5124f9ac75) [x86_64-darwin23]</th>
</tr>
<tr>
<th>Library</th>
<th>Slower geometric mean</th>
</tr>
@@ -789,37 +680,37 @@
<td>pairing_heap</td>
<td>1</td>
</tr>
<tr>
<td>lazy_priority_queue</td>
- <td>1.688x slower</td>
+ <td>2.1x slower</td>
</tr>
<tr>
<td>Fibonacci</td>
- <td>1.987x slower</td>
+ <td>3.38x slower</td>
</tr>
<tr>
- <th colspan="4">ruby 3.1.2p20 (2022-04-12 revision 4491bb740a) +YJIT [x86_64-darwin21]</th>
+ <th colspan="4">ruby 3.3.0 (2023-12-25 revision 5124f9ac75) +YJIT [x86_64-darwin23]</th>
</tr>
<tr>
<th>Library</th>
<th>Slower geometric mean</th>
</tr>
<tr>
<td>pairing_heap</td>
<td>1</td>
</tr>
<tr>
- <td>Fibonacci</td>
- <td>1.256x slower</td>
+ <td>lazy_priority_queue</td>
+ <td>2.55x slower</td>
</tr>
<tr>
- <td>lazy_priority_queue</td>
- <td>1.648x slower</td>
+ <td>Fibonacci</td>
+ <td>2.74x slower</td>
</tr>
<tr>
- <th colspan="4">jruby 9.3.7.0 (2.6.8) 2022-08-16 c79ef237e0 OpenJDK 64-Bit Server VM 17.0.2+8-86 on 17.0.2+8-86 +indy +jit [x86_64-darwin]</th>
+ <th colspan="4">jruby 9.4.5.0 (3.1.4) 2023-11-02 1abae2700f OpenJDK 64-Bit Server VM 21+35-2513 on 21+35-2513 +indy +jit [x86_64-darwin]</th>
</tr>
<tr>
<th>Library</th>
<th>Slower geometric mean</th>
</tr>
@@ -827,18 +718,18 @@
<td>pairing_heap</td>
<td>1</td>
</tr>
<tr>
<td>Fibonacci</td>
- <td>1.327x slower</td>
+ <td>1.267x slower</td>
</tr>
<tr>
<td>lazy_priority_queue</td>
- <td>1.383x slower</td>
+ <td>1.396x slower</td>
</tr>
<tr>
- <th colspan="4">truffleruby 22.2.0, like ruby 3.0.3, GraalVM CE JVM [x86_64-darwin]</th>
+ <th colspan="4">truffleruby 23.1.2, like ruby 3.2.2, Oracle GraalVM JVM [x86_64-darwin]</th>
</tr>
<tr>
<th>Library</th>
<th>Slower geometric mean</th>
</tr>
@@ -846,22 +737,22 @@
<td>pairing_heap</td>
<td>1</td>
</tr>
<tr>
<td>lazy_priority_queue</td>
- <td>3.878x slower</td>
+ <td>3.54x slower</td>
</tr>
<tr>
<td>Fibonacci</td>
- <td>9.889x slower</td>
+ <td>5.86x slower</td>
</tr>
</table>
#### Change priority not required
<table>
<tr>
- <th colspan="4">ruby 3.1.2p20 (2022-04-12 revision 4491bb740a) [x86_64-darwin21]</th>
+ <th colspan="4">ruby 3.3.0 (2023-12-25 revision 5124f9ac75) [x86_64-darwin23]</th>
</tr>
<tr>
<th>Library</th>
<th>Slower geometric mean</th>
</tr>
@@ -869,103 +760,103 @@
<td>pairing_heap (SimplePairingHeap)</td>
<td>1</td>
</tr>
<tr>
<td>pairing_heap (PairingHeap)</td>
- <td>1.318x slower</td>
+ <td>1.29x slower</td>
</tr>
<tr>
<td>rb_heap</td>
- <td>1.8x slower</td>
+ <td>1.53x slower</td>
</tr>
<tr>
<td>lazy_priority_queue</td>
- <td>2.519x slower</td>
+ <td>2.6x slower</td>
</tr>
<tr>
<td>Fibonacci</td>
- <td>2.989x slower</td>
+ <td>4.29x slower</td>
</tr>
<tr>
- <th colspan="4">ruby 3.1.2p20 (2022-04-12 revision 4491bb740a) +YJIT [x86_64-darwin21]</th>
+ <th colspan="4">ruby 3.3.0 (2023-12-25 revision 5124f9ac75) +YJIT [x86_64-darwin23]</th>
</tr>
<tr>
<th>Library</th>
<th>Slower geometric mean</th>
</tr>
<tr>
<td>pairing_heap (SimplePairingHeap)</td>
<td>1</td>
</tr>
<tr>
- <td>pairing_heap (PairingHeap)</td>
- <td>1.348x slower</td>
- </tr>
- <tr>
<td>rb_heap</td>
- <td>1.490x slower</td>
+ <td>1.227x slower</td>
</tr>
<tr>
- <td>Fibonacci</td>
- <td>1.792x slower</td>
+ <td>pairing_heap (PairingHeap)</td>
+ <td>1.316x slower</td>
</tr>
<tr>
<td>lazy_priority_queue</td>
- <td>2.492x slower</td>
+ <td>3.094x slower</td>
</tr>
<tr>
- <th colspan="4">jruby 9.3.7.0 (2.6.8) 2022-08-16 c79ef237e0 OpenJDK 64-Bit Server VM 17.0.2+8-86 on 17.0.2+8-86 +indy +jit [x86_64-darwin]</th>
+ <td>Fibonacci</td>
+ <td>3.79x slower</td>
</tr>
<tr>
+ <th colspan="4">jruby 9.4.5.0 (3.1.4) 2023-11-02 1abae2700f OpenJDK 64-Bit Server VM 21+35-2513 on 21+35-2513 +indy +jit [x86_64-darwin]</th>
+ </tr>
+ <tr>
<th>Library</th>
<th>Slower geometric mean</th>
</tr>
<tr>
<td>pairing_heap (SimplePairingHeap)</td>
- <td>1</td>
+ <td>1.033x slower</td>
</tr>
<tr>
<td>rb_heap</td>
- <td>1.292x slower</td>
+ <td>1.133x slower</td>
</tr>
<tr>
<td>pairing_heap (PairingHeap)</td>
- <td>1.359x slower</td>
+ <td>1.302x slower</td>
</tr>
<tr>
<td>Fibonacci</td>
- <td>1.824x slower</td>
+ <td>1.602x slower</td>
</tr>
<tr>
<td>lazy_priority_queue</td>
- <td>2.115x slower</td>
+ <td>1.777x slower</td>
</tr>
<tr>
- <th colspan="4">truffleruby 22.2.0, like ruby 3.0.3, GraalVM CE JVM [x86_64-darwin]</th>
+ <th colspan="4">truffleruby 23.1.2, like ruby 3.2.2, Oracle GraalVM JVM [x86_64-darwin]</th>
</tr>
<tr>
<th>Library</th>
<th>Slower geometric mean</th>
</tr>
<tr>
<td>pairing_heap (SimplePairingHeap)</td>
<td>1</td>
</tr>
<tr>
- <td>pairing_heap (PairingHeap)</td>
- <td>1.865x slower</td>
+ <td>rb_heap</td>
+ <td>1.35x slower</td>
</tr>
<tr>
- <td>rb_heap</td>
- <td>1.915x slower</td>
+ <td>pairing_heap (PairingHeap)</td>
+ <td>1.58x slower</td>
</tr>
<tr>
<td>lazy_priority_queue</td>
- <td>8.791x slower</td>
+ <td>5.46x slower</td>
</tr>
<tr>
<td>Fibonacci</td>
- <td>26.044x slower</td>
+ <td>7.54x slower</td>
</tr>
</table>
## Development