data-structure-typed 1.42.1 → 1.42.3
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.
- package/CHANGELOG.md +1 -1
- package/README.md +12 -12
- package/benchmark/report.html +12 -12
- package/benchmark/report.json +105 -105
- package/dist/cjs/src/data-structures/binary-tree/binary-tree.d.ts +1 -1
- package/dist/cjs/src/data-structures/binary-tree/binary-tree.js +1 -1
- package/dist/cjs/src/data-structures/binary-tree/binary-tree.js.map +1 -1
- package/dist/cjs/src/data-structures/graph/abstract-graph.d.ts +39 -9
- package/dist/cjs/src/data-structures/graph/abstract-graph.js +56 -14
- package/dist/cjs/src/data-structures/graph/abstract-graph.js.map +1 -1
- package/dist/mjs/src/data-structures/binary-tree/binary-tree.d.ts +1 -1
- package/dist/mjs/src/data-structures/binary-tree/binary-tree.js +2 -2
- package/dist/mjs/src/data-structures/graph/abstract-graph.d.ts +39 -9
- package/dist/mjs/src/data-structures/graph/abstract-graph.js +56 -14
- package/dist/umd/data-structure-typed.min.js +1 -1
- package/dist/umd/data-structure-typed.min.js.map +1 -1
- package/package.json +2 -2
- package/src/data-structures/binary-tree/binary-tree.ts +30 -31
- package/src/data-structures/graph/abstract-graph.ts +70 -22
- package/test/performance/reportor.ts +1 -0
- package/test/unit/data-structures/binary-tree/binary-tree.test.ts +34 -15
- package/test/unit/data-structures/binary-tree/bst.test.ts +13 -0
- package/test/unit/data-structures/graph/directed-graph.test.ts +34 -1
- package/test/unit/data-structures/graph/salty-edges.json +875 -1
- package/test/unit/data-structures/graph/salty-vertexes.json +200 -1
- package/test/unit/data-structures/graph/undirected-graph.test.ts +41 -8
package/CHANGELOG.md
CHANGED
|
@@ -8,7 +8,7 @@ All notable changes to this project will be documented in this file.
|
|
|
8
8
|
- [Semantic Versioning](https://semver.org/spec/v2.0.0.html)
|
|
9
9
|
- [`auto-changelog`](https://github.com/CookPete/auto-changelog)
|
|
10
10
|
|
|
11
|
-
## [v1.42.
|
|
11
|
+
## [v1.42.3](https://github.com/zrwusa/data-structure-typed/compare/v1.35.0...main) (upcoming)
|
|
12
12
|
|
|
13
13
|
### Changes
|
|
14
14
|
|
package/README.md
CHANGED
|
@@ -636,40 +636,40 @@ optimal approach to data structure design.
|
|
|
636
636
|
[//]: # (Start of Replace Section)
|
|
637
637
|
<div class="json-to-html-collapse clearfix 0">
|
|
638
638
|
<div class='collapsible level0' ><span class='json-to-html-label'>avl-tree</span></div>
|
|
639
|
-
<div class="content"><table style="display: table; width:100%; table-layout: fixed;"><tr><th>test name</th><th>time taken (ms)</th><th>executions per sec</th><th>sample deviation</th></tr><tr><td>10,000 add randomly</td><td>30.
|
|
639
|
+
<div class="content"><table style="display: table; width:100%; table-layout: fixed;"><tr><th>test name</th><th>time taken (ms)</th><th>executions per sec</th><th>sample deviation</th></tr><tr><td>10,000 add randomly</td><td>30.33</td><td>32.97</td><td>3.56e-4</td></tr><tr><td>10,000 add & delete randomly</td><td>66.10</td><td>15.13</td><td>0.00</td></tr><tr><td>10,000 addMany</td><td>39.44</td><td>25.35</td><td>3.62e-4</td></tr><tr><td>10,000 get</td><td>27.06</td><td>36.96</td><td>2.52e-4</td></tr></table></div>
|
|
640
640
|
</div><div class="json-to-html-collapse clearfix 0">
|
|
641
641
|
<div class='collapsible level0' ><span class='json-to-html-label'>binary-tree</span></div>
|
|
642
|
-
<div class="content"><table style="display: table; width:100%; table-layout: fixed;"><tr><th>test name</th><th>time taken (ms)</th><th>executions per sec</th><th>sample deviation</th></tr><tr><td>1,000 add randomly</td><td>12.
|
|
642
|
+
<div class="content"><table style="display: table; width:100%; table-layout: fixed;"><tr><th>test name</th><th>time taken (ms)</th><th>executions per sec</th><th>sample deviation</th></tr><tr><td>1,000 add randomly</td><td>12.90</td><td>77.52</td><td>1.09e-4</td></tr><tr><td>1,000 add & delete randomly</td><td>16.13</td><td>61.99</td><td>1.61e-4</td></tr><tr><td>1,000 addMany</td><td>10.74</td><td>93.09</td><td>1.00e-4</td></tr><tr><td>1,000 get</td><td>18.09</td><td>55.28</td><td>1.90e-4</td></tr><tr><td>1,000 dfs</td><td>71.12</td><td>14.06</td><td>7.83e-4</td></tr><tr><td>1,000 bfs</td><td>57.24</td><td>17.47</td><td>4.17e-4</td></tr><tr><td>1,000 morris</td><td>37.29</td><td>26.81</td><td>3.77e-4</td></tr></table></div>
|
|
643
643
|
</div><div class="json-to-html-collapse clearfix 0">
|
|
644
644
|
<div class='collapsible level0' ><span class='json-to-html-label'>bst</span></div>
|
|
645
|
-
<div class="content"><table style="display: table; width:100%; table-layout: fixed;"><tr><th>test name</th><th>time taken (ms)</th><th>executions per sec</th><th>sample deviation</th></tr><tr><td>10,000 add randomly</td><td>
|
|
645
|
+
<div class="content"><table style="display: table; width:100%; table-layout: fixed;"><tr><th>test name</th><th>time taken (ms)</th><th>executions per sec</th><th>sample deviation</th></tr><tr><td>10,000 add randomly</td><td>31.58</td><td>31.67</td><td>0.00</td></tr><tr><td>10,000 add & delete randomly</td><td>71.09</td><td>14.07</td><td>8.99e-4</td></tr><tr><td>10,000 addMany</td><td>29.68</td><td>33.69</td><td>0.00</td></tr><tr><td>10,000 get</td><td>28.55</td><td>35.03</td><td>0.00</td></tr></table></div>
|
|
646
646
|
</div><div class="json-to-html-collapse clearfix 0">
|
|
647
647
|
<div class='collapsible level0' ><span class='json-to-html-label'>rb-tree</span></div>
|
|
648
|
-
<div class="content"><table style="display: table; width:100%; table-layout: fixed;"><tr><th>test name</th><th>time taken (ms)</th><th>executions per sec</th><th>sample deviation</th></tr><tr><td>100,000 add randomly</td><td>
|
|
648
|
+
<div class="content"><table style="display: table; width:100%; table-layout: fixed;"><tr><th>test name</th><th>time taken (ms)</th><th>executions per sec</th><th>sample deviation</th></tr><tr><td>100,000 add randomly</td><td>84.64</td><td>11.82</td><td>0.01</td></tr><tr><td>100,000 add & 1000 delete randomly</td><td>81.32</td><td>12.30</td><td>0.01</td></tr><tr><td>100,000 getNode</td><td>61.18</td><td>16.35</td><td>0.00</td></tr></table></div>
|
|
649
649
|
</div><div class="json-to-html-collapse clearfix 0">
|
|
650
650
|
<div class='collapsible level0' ><span class='json-to-html-label'>directed-graph</span></div>
|
|
651
|
-
<div class="content"><table style="display: table; width:100%; table-layout: fixed;"><tr><th>test name</th><th>time taken (ms)</th><th>executions per sec</th><th>sample deviation</th></tr><tr><td>1,000 addVertex</td><td>0.10</td><td>
|
|
651
|
+
<div class="content"><table style="display: table; width:100%; table-layout: fixed;"><tr><th>test name</th><th>time taken (ms)</th><th>executions per sec</th><th>sample deviation</th></tr><tr><td>1,000 addVertex</td><td>0.10</td><td>9637.47</td><td>3.79e-6</td></tr><tr><td>1,000 addEdge</td><td>6.09</td><td>164.18</td><td>1.31e-4</td></tr><tr><td>1,000 getVertex</td><td>0.05</td><td>2.14e+4</td><td>1.35e-6</td></tr><tr><td>1,000 getEdge</td><td>23.91</td><td>41.82</td><td>0.01</td></tr><tr><td>tarjan</td><td>218.65</td><td>4.57</td><td>0.01</td></tr><tr><td>tarjan all</td><td>221.67</td><td>4.51</td><td>0.00</td></tr><tr><td>topologicalSort</td><td>184.34</td><td>5.42</td><td>0.02</td></tr></table></div>
|
|
652
652
|
</div><div class="json-to-html-collapse clearfix 0">
|
|
653
653
|
<div class='collapsible level0' ><span class='json-to-html-label'>heap</span></div>
|
|
654
|
-
<div class="content"><table style="display: table; width:100%; table-layout: fixed;"><tr><th>test name</th><th>time taken (ms)</th><th>executions per sec</th><th>sample deviation</th></tr><tr><td>10,000 add & pop</td><td>4.
|
|
654
|
+
<div class="content"><table style="display: table; width:100%; table-layout: fixed;"><tr><th>test name</th><th>time taken (ms)</th><th>executions per sec</th><th>sample deviation</th></tr><tr><td>10,000 add & pop</td><td>4.63</td><td>215.77</td><td>4.49e-5</td></tr><tr><td>10,000 fib add & pop</td><td>355.19</td><td>2.82</td><td>0.00</td></tr></table></div>
|
|
655
655
|
</div><div class="json-to-html-collapse clearfix 0">
|
|
656
656
|
<div class='collapsible level0' ><span class='json-to-html-label'>doubly-linked-list</span></div>
|
|
657
|
-
<div class="content"><table style="display: table; width:100%; table-layout: fixed;"><tr><th>test name</th><th>time taken (ms)</th><th>executions per sec</th><th>sample deviation</th></tr><tr><td>1,000,000 unshift</td><td>
|
|
657
|
+
<div class="content"><table style="display: table; width:100%; table-layout: fixed;"><tr><th>test name</th><th>time taken (ms)</th><th>executions per sec</th><th>sample deviation</th></tr><tr><td>1,000,000 unshift</td><td>213.53</td><td>4.68</td><td>0.02</td></tr><tr><td>1,000,000 unshift & shift</td><td>162.97</td><td>6.14</td><td>0.02</td></tr><tr><td>1,000,000 insertBefore</td><td>335.19</td><td>2.98</td><td>0.09</td></tr></table></div>
|
|
658
658
|
</div><div class="json-to-html-collapse clearfix 0">
|
|
659
659
|
<div class='collapsible level0' ><span class='json-to-html-label'>singly-linked-list</span></div>
|
|
660
|
-
<div class="content"><table style="display: table; width:100%; table-layout: fixed;"><tr><th>test name</th><th>time taken (ms)</th><th>executions per sec</th><th>sample deviation</th></tr><tr><td>10,000 push & pop</td><td>
|
|
660
|
+
<div class="content"><table style="display: table; width:100%; table-layout: fixed;"><tr><th>test name</th><th>time taken (ms)</th><th>executions per sec</th><th>sample deviation</th></tr><tr><td>10,000 push & pop</td><td>231.35</td><td>4.32</td><td>0.02</td></tr><tr><td>10,000 insertBefore</td><td>251.49</td><td>3.98</td><td>0.01</td></tr></table></div>
|
|
661
661
|
</div><div class="json-to-html-collapse clearfix 0">
|
|
662
662
|
<div class='collapsible level0' ><span class='json-to-html-label'>max-priority-queue</span></div>
|
|
663
|
-
<div class="content"><table style="display: table; width:100%; table-layout: fixed;"><tr><th>test name</th><th>time taken (ms)</th><th>executions per sec</th><th>sample deviation</th></tr><tr><td>10,000 refill & poll</td><td>11.
|
|
663
|
+
<div class="content"><table style="display: table; width:100%; table-layout: fixed;"><tr><th>test name</th><th>time taken (ms)</th><th>executions per sec</th><th>sample deviation</th></tr><tr><td>10,000 refill & poll</td><td>11.48</td><td>87.14</td><td>1.91e-4</td></tr></table></div>
|
|
664
664
|
</div><div class="json-to-html-collapse clearfix 0">
|
|
665
665
|
<div class='collapsible level0' ><span class='json-to-html-label'>deque</span></div>
|
|
666
|
-
<div class="content"><table style="display: table; width:100%; table-layout: fixed;"><tr><th>test name</th><th>time taken (ms)</th><th>executions per sec</th><th>sample deviation</th></tr><tr><td>1,000,000 push</td><td>
|
|
666
|
+
<div class="content"><table style="display: table; width:100%; table-layout: fixed;"><tr><th>test name</th><th>time taken (ms)</th><th>executions per sec</th><th>sample deviation</th></tr><tr><td>1,000,000 push</td><td>215.14</td><td>4.65</td><td>0.05</td></tr><tr><td>1,000,000 shift</td><td>25.15</td><td>39.76</td><td>0.00</td></tr></table></div>
|
|
667
667
|
</div><div class="json-to-html-collapse clearfix 0">
|
|
668
668
|
<div class='collapsible level0' ><span class='json-to-html-label'>queue</span></div>
|
|
669
|
-
<div class="content"><table style="display: table; width:100%; table-layout: fixed;"><tr><th>test name</th><th>time taken (ms)</th><th>executions per sec</th><th>sample deviation</th></tr><tr><td>1,000,000 push</td><td>
|
|
669
|
+
<div class="content"><table style="display: table; width:100%; table-layout: fixed;"><tr><th>test name</th><th>time taken (ms)</th><th>executions per sec</th><th>sample deviation</th></tr><tr><td>1,000,000 push</td><td>44.15</td><td>22.65</td><td>0.01</td></tr><tr><td>1,000,000 push & shift</td><td>80.87</td><td>12.37</td><td>0.00</td></tr></table></div>
|
|
670
670
|
</div><div class="json-to-html-collapse clearfix 0">
|
|
671
671
|
<div class='collapsible level0' ><span class='json-to-html-label'>trie</span></div>
|
|
672
|
-
<div class="content"><table style="display: table; width:100%; table-layout: fixed;"><tr><th>test name</th><th>time taken (ms)</th><th>executions per sec</th><th>sample deviation</th></tr><tr><td>100,000 push</td><td>
|
|
672
|
+
<div class="content"><table style="display: table; width:100%; table-layout: fixed;"><tr><th>test name</th><th>time taken (ms)</th><th>executions per sec</th><th>sample deviation</th></tr><tr><td>100,000 push</td><td>61.38</td><td>16.29</td><td>0.01</td></tr><tr><td>100,000 getWords</td><td>104.27</td><td>9.59</td><td>0.02</td></tr></table></div>
|
|
673
673
|
</div>
|
|
674
674
|
|
|
675
675
|
[//]: # (End of Replace Section)
|
package/benchmark/report.html
CHANGED
|
@@ -43,40 +43,40 @@
|
|
|
43
43
|
<body>
|
|
44
44
|
<div id="json-to-html"><div class="json-to-html-collapse clearfix 0">
|
|
45
45
|
<div class='collapsible level0' ><span class='json-to-html-label'>avl-tree</span></div>
|
|
46
|
-
<div class="content"><table style="display: table; width:100%; table-layout: fixed;"><tr><th>test name</th><th>time taken (ms)</th><th>executions per sec</th><th>sample deviation</th></tr><tr><td>10,000 add randomly</td><td>30.
|
|
46
|
+
<div class="content"><table style="display: table; width:100%; table-layout: fixed;"><tr><th>test name</th><th>time taken (ms)</th><th>executions per sec</th><th>sample deviation</th></tr><tr><td>10,000 add randomly</td><td>30.33</td><td>32.97</td><td>3.56e-4</td></tr><tr><td>10,000 add & delete randomly</td><td>66.10</td><td>15.13</td><td>0.00</td></tr><tr><td>10,000 addMany</td><td>39.44</td><td>25.35</td><td>3.62e-4</td></tr><tr><td>10,000 get</td><td>27.06</td><td>36.96</td><td>2.52e-4</td></tr></table></div>
|
|
47
47
|
</div><div class="json-to-html-collapse clearfix 0">
|
|
48
48
|
<div class='collapsible level0' ><span class='json-to-html-label'>binary-tree</span></div>
|
|
49
|
-
<div class="content"><table style="display: table; width:100%; table-layout: fixed;"><tr><th>test name</th><th>time taken (ms)</th><th>executions per sec</th><th>sample deviation</th></tr><tr><td>1,000 add randomly</td><td>12.
|
|
49
|
+
<div class="content"><table style="display: table; width:100%; table-layout: fixed;"><tr><th>test name</th><th>time taken (ms)</th><th>executions per sec</th><th>sample deviation</th></tr><tr><td>1,000 add randomly</td><td>12.90</td><td>77.52</td><td>1.09e-4</td></tr><tr><td>1,000 add & delete randomly</td><td>16.13</td><td>61.99</td><td>1.61e-4</td></tr><tr><td>1,000 addMany</td><td>10.74</td><td>93.09</td><td>1.00e-4</td></tr><tr><td>1,000 get</td><td>18.09</td><td>55.28</td><td>1.90e-4</td></tr><tr><td>1,000 dfs</td><td>71.12</td><td>14.06</td><td>7.83e-4</td></tr><tr><td>1,000 bfs</td><td>57.24</td><td>17.47</td><td>4.17e-4</td></tr><tr><td>1,000 morris</td><td>37.29</td><td>26.81</td><td>3.77e-4</td></tr></table></div>
|
|
50
50
|
</div><div class="json-to-html-collapse clearfix 0">
|
|
51
51
|
<div class='collapsible level0' ><span class='json-to-html-label'>bst</span></div>
|
|
52
|
-
<div class="content"><table style="display: table; width:100%; table-layout: fixed;"><tr><th>test name</th><th>time taken (ms)</th><th>executions per sec</th><th>sample deviation</th></tr><tr><td>10,000 add randomly</td><td>
|
|
52
|
+
<div class="content"><table style="display: table; width:100%; table-layout: fixed;"><tr><th>test name</th><th>time taken (ms)</th><th>executions per sec</th><th>sample deviation</th></tr><tr><td>10,000 add randomly</td><td>31.58</td><td>31.67</td><td>0.00</td></tr><tr><td>10,000 add & delete randomly</td><td>71.09</td><td>14.07</td><td>8.99e-4</td></tr><tr><td>10,000 addMany</td><td>29.68</td><td>33.69</td><td>0.00</td></tr><tr><td>10,000 get</td><td>28.55</td><td>35.03</td><td>0.00</td></tr></table></div>
|
|
53
53
|
</div><div class="json-to-html-collapse clearfix 0">
|
|
54
54
|
<div class='collapsible level0' ><span class='json-to-html-label'>rb-tree</span></div>
|
|
55
|
-
<div class="content"><table style="display: table; width:100%; table-layout: fixed;"><tr><th>test name</th><th>time taken (ms)</th><th>executions per sec</th><th>sample deviation</th></tr><tr><td>100,000 add randomly</td><td>
|
|
55
|
+
<div class="content"><table style="display: table; width:100%; table-layout: fixed;"><tr><th>test name</th><th>time taken (ms)</th><th>executions per sec</th><th>sample deviation</th></tr><tr><td>100,000 add randomly</td><td>84.64</td><td>11.82</td><td>0.01</td></tr><tr><td>100,000 add & 1000 delete randomly</td><td>81.32</td><td>12.30</td><td>0.01</td></tr><tr><td>100,000 getNode</td><td>61.18</td><td>16.35</td><td>0.00</td></tr></table></div>
|
|
56
56
|
</div><div class="json-to-html-collapse clearfix 0">
|
|
57
57
|
<div class='collapsible level0' ><span class='json-to-html-label'>directed-graph</span></div>
|
|
58
|
-
<div class="content"><table style="display: table; width:100%; table-layout: fixed;"><tr><th>test name</th><th>time taken (ms)</th><th>executions per sec</th><th>sample deviation</th></tr><tr><td>1,000 addVertex</td><td>0.10</td><td>
|
|
58
|
+
<div class="content"><table style="display: table; width:100%; table-layout: fixed;"><tr><th>test name</th><th>time taken (ms)</th><th>executions per sec</th><th>sample deviation</th></tr><tr><td>1,000 addVertex</td><td>0.10</td><td>9637.47</td><td>3.79e-6</td></tr><tr><td>1,000 addEdge</td><td>6.09</td><td>164.18</td><td>1.31e-4</td></tr><tr><td>1,000 getVertex</td><td>0.05</td><td>2.14e+4</td><td>1.35e-6</td></tr><tr><td>1,000 getEdge</td><td>23.91</td><td>41.82</td><td>0.01</td></tr><tr><td>tarjan</td><td>218.65</td><td>4.57</td><td>0.01</td></tr><tr><td>tarjan all</td><td>221.67</td><td>4.51</td><td>0.00</td></tr><tr><td>topologicalSort</td><td>184.34</td><td>5.42</td><td>0.02</td></tr></table></div>
|
|
59
59
|
</div><div class="json-to-html-collapse clearfix 0">
|
|
60
60
|
<div class='collapsible level0' ><span class='json-to-html-label'>heap</span></div>
|
|
61
|
-
<div class="content"><table style="display: table; width:100%; table-layout: fixed;"><tr><th>test name</th><th>time taken (ms)</th><th>executions per sec</th><th>sample deviation</th></tr><tr><td>10,000 add & pop</td><td>4.
|
|
61
|
+
<div class="content"><table style="display: table; width:100%; table-layout: fixed;"><tr><th>test name</th><th>time taken (ms)</th><th>executions per sec</th><th>sample deviation</th></tr><tr><td>10,000 add & pop</td><td>4.63</td><td>215.77</td><td>4.49e-5</td></tr><tr><td>10,000 fib add & pop</td><td>355.19</td><td>2.82</td><td>0.00</td></tr></table></div>
|
|
62
62
|
</div><div class="json-to-html-collapse clearfix 0">
|
|
63
63
|
<div class='collapsible level0' ><span class='json-to-html-label'>doubly-linked-list</span></div>
|
|
64
|
-
<div class="content"><table style="display: table; width:100%; table-layout: fixed;"><tr><th>test name</th><th>time taken (ms)</th><th>executions per sec</th><th>sample deviation</th></tr><tr><td>1,000,000 unshift</td><td>
|
|
64
|
+
<div class="content"><table style="display: table; width:100%; table-layout: fixed;"><tr><th>test name</th><th>time taken (ms)</th><th>executions per sec</th><th>sample deviation</th></tr><tr><td>1,000,000 unshift</td><td>213.53</td><td>4.68</td><td>0.02</td></tr><tr><td>1,000,000 unshift & shift</td><td>162.97</td><td>6.14</td><td>0.02</td></tr><tr><td>1,000,000 insertBefore</td><td>335.19</td><td>2.98</td><td>0.09</td></tr></table></div>
|
|
65
65
|
</div><div class="json-to-html-collapse clearfix 0">
|
|
66
66
|
<div class='collapsible level0' ><span class='json-to-html-label'>singly-linked-list</span></div>
|
|
67
|
-
<div class="content"><table style="display: table; width:100%; table-layout: fixed;"><tr><th>test name</th><th>time taken (ms)</th><th>executions per sec</th><th>sample deviation</th></tr><tr><td>10,000 push & pop</td><td>
|
|
67
|
+
<div class="content"><table style="display: table; width:100%; table-layout: fixed;"><tr><th>test name</th><th>time taken (ms)</th><th>executions per sec</th><th>sample deviation</th></tr><tr><td>10,000 push & pop</td><td>231.35</td><td>4.32</td><td>0.02</td></tr><tr><td>10,000 insertBefore</td><td>251.49</td><td>3.98</td><td>0.01</td></tr></table></div>
|
|
68
68
|
</div><div class="json-to-html-collapse clearfix 0">
|
|
69
69
|
<div class='collapsible level0' ><span class='json-to-html-label'>max-priority-queue</span></div>
|
|
70
|
-
<div class="content"><table style="display: table; width:100%; table-layout: fixed;"><tr><th>test name</th><th>time taken (ms)</th><th>executions per sec</th><th>sample deviation</th></tr><tr><td>10,000 refill & poll</td><td>11.
|
|
70
|
+
<div class="content"><table style="display: table; width:100%; table-layout: fixed;"><tr><th>test name</th><th>time taken (ms)</th><th>executions per sec</th><th>sample deviation</th></tr><tr><td>10,000 refill & poll</td><td>11.48</td><td>87.14</td><td>1.91e-4</td></tr></table></div>
|
|
71
71
|
</div><div class="json-to-html-collapse clearfix 0">
|
|
72
72
|
<div class='collapsible level0' ><span class='json-to-html-label'>deque</span></div>
|
|
73
|
-
<div class="content"><table style="display: table; width:100%; table-layout: fixed;"><tr><th>test name</th><th>time taken (ms)</th><th>executions per sec</th><th>sample deviation</th></tr><tr><td>1,000,000 push</td><td>
|
|
73
|
+
<div class="content"><table style="display: table; width:100%; table-layout: fixed;"><tr><th>test name</th><th>time taken (ms)</th><th>executions per sec</th><th>sample deviation</th></tr><tr><td>1,000,000 push</td><td>215.14</td><td>4.65</td><td>0.05</td></tr><tr><td>1,000,000 shift</td><td>25.15</td><td>39.76</td><td>0.00</td></tr></table></div>
|
|
74
74
|
</div><div class="json-to-html-collapse clearfix 0">
|
|
75
75
|
<div class='collapsible level0' ><span class='json-to-html-label'>queue</span></div>
|
|
76
|
-
<div class="content"><table style="display: table; width:100%; table-layout: fixed;"><tr><th>test name</th><th>time taken (ms)</th><th>executions per sec</th><th>sample deviation</th></tr><tr><td>1,000,000 push</td><td>
|
|
76
|
+
<div class="content"><table style="display: table; width:100%; table-layout: fixed;"><tr><th>test name</th><th>time taken (ms)</th><th>executions per sec</th><th>sample deviation</th></tr><tr><td>1,000,000 push</td><td>44.15</td><td>22.65</td><td>0.01</td></tr><tr><td>1,000,000 push & shift</td><td>80.87</td><td>12.37</td><td>0.00</td></tr></table></div>
|
|
77
77
|
</div><div class="json-to-html-collapse clearfix 0">
|
|
78
78
|
<div class='collapsible level0' ><span class='json-to-html-label'>trie</span></div>
|
|
79
|
-
<div class="content"><table style="display: table; width:100%; table-layout: fixed;"><tr><th>test name</th><th>time taken (ms)</th><th>executions per sec</th><th>sample deviation</th></tr><tr><td>100,000 push</td><td>
|
|
79
|
+
<div class="content"><table style="display: table; width:100%; table-layout: fixed;"><tr><th>test name</th><th>time taken (ms)</th><th>executions per sec</th><th>sample deviation</th></tr><tr><td>100,000 push</td><td>61.38</td><td>16.29</td><td>0.01</td></tr><tr><td>100,000 getWords</td><td>104.27</td><td>9.59</td><td>0.02</td></tr></table></div>
|
|
80
80
|
</div>
|
|
81
81
|
|
|
82
82
|
</div>
|
package/benchmark/report.json
CHANGED
|
@@ -3,27 +3,27 @@
|
|
|
3
3
|
"benchmarks": [
|
|
4
4
|
{
|
|
5
5
|
"test name": "10,000 add randomly",
|
|
6
|
-
"time taken (ms)": "30.
|
|
7
|
-
"executions per sec": "32.
|
|
8
|
-
"sample deviation": "
|
|
6
|
+
"time taken (ms)": "30.33",
|
|
7
|
+
"executions per sec": "32.97",
|
|
8
|
+
"sample deviation": "3.56e-4"
|
|
9
9
|
},
|
|
10
10
|
{
|
|
11
11
|
"test name": "10,000 add & delete randomly",
|
|
12
|
-
"time taken (ms)": "
|
|
13
|
-
"executions per sec": "
|
|
12
|
+
"time taken (ms)": "66.10",
|
|
13
|
+
"executions per sec": "15.13",
|
|
14
14
|
"sample deviation": "0.00"
|
|
15
15
|
},
|
|
16
16
|
{
|
|
17
17
|
"test name": "10,000 addMany",
|
|
18
|
-
"time taken (ms)": "39.
|
|
19
|
-
"executions per sec": "25.
|
|
20
|
-
"sample deviation": "
|
|
18
|
+
"time taken (ms)": "39.44",
|
|
19
|
+
"executions per sec": "25.35",
|
|
20
|
+
"sample deviation": "3.62e-4"
|
|
21
21
|
},
|
|
22
22
|
{
|
|
23
23
|
"test name": "10,000 get",
|
|
24
|
-
"time taken (ms)": "
|
|
25
|
-
"executions per sec": "
|
|
26
|
-
"sample deviation": "2.
|
|
24
|
+
"time taken (ms)": "27.06",
|
|
25
|
+
"executions per sec": "36.96",
|
|
26
|
+
"sample deviation": "2.52e-4"
|
|
27
27
|
}
|
|
28
28
|
],
|
|
29
29
|
"testName": "avl-tree"
|
|
@@ -32,45 +32,45 @@
|
|
|
32
32
|
"benchmarks": [
|
|
33
33
|
{
|
|
34
34
|
"test name": "1,000 add randomly",
|
|
35
|
-
"time taken (ms)": "12.
|
|
36
|
-
"executions per sec": "77.
|
|
37
|
-
"sample deviation": "
|
|
35
|
+
"time taken (ms)": "12.90",
|
|
36
|
+
"executions per sec": "77.52",
|
|
37
|
+
"sample deviation": "1.09e-4"
|
|
38
38
|
},
|
|
39
39
|
{
|
|
40
40
|
"test name": "1,000 add & delete randomly",
|
|
41
|
-
"time taken (ms)": "
|
|
42
|
-
"executions per sec": "
|
|
43
|
-
"sample deviation": "1.
|
|
41
|
+
"time taken (ms)": "16.13",
|
|
42
|
+
"executions per sec": "61.99",
|
|
43
|
+
"sample deviation": "1.61e-4"
|
|
44
44
|
},
|
|
45
45
|
{
|
|
46
46
|
"test name": "1,000 addMany",
|
|
47
|
-
"time taken (ms)": "10.
|
|
48
|
-
"executions per sec": "93.
|
|
49
|
-
"sample deviation": "1.
|
|
47
|
+
"time taken (ms)": "10.74",
|
|
48
|
+
"executions per sec": "93.09",
|
|
49
|
+
"sample deviation": "1.00e-4"
|
|
50
50
|
},
|
|
51
51
|
{
|
|
52
52
|
"test name": "1,000 get",
|
|
53
|
-
"time taken (ms)": "18.
|
|
54
|
-
"executions per sec": "
|
|
55
|
-
"sample deviation": "
|
|
53
|
+
"time taken (ms)": "18.09",
|
|
54
|
+
"executions per sec": "55.28",
|
|
55
|
+
"sample deviation": "1.90e-4"
|
|
56
56
|
},
|
|
57
57
|
{
|
|
58
58
|
"test name": "1,000 dfs",
|
|
59
|
-
"time taken (ms)": "71.
|
|
60
|
-
"executions per sec": "
|
|
61
|
-
"sample deviation": "
|
|
59
|
+
"time taken (ms)": "71.12",
|
|
60
|
+
"executions per sec": "14.06",
|
|
61
|
+
"sample deviation": "7.83e-4"
|
|
62
62
|
},
|
|
63
63
|
{
|
|
64
64
|
"test name": "1,000 bfs",
|
|
65
|
-
"time taken (ms)": "57.
|
|
66
|
-
"executions per sec": "17.
|
|
67
|
-
"sample deviation": "
|
|
65
|
+
"time taken (ms)": "57.24",
|
|
66
|
+
"executions per sec": "17.47",
|
|
67
|
+
"sample deviation": "4.17e-4"
|
|
68
68
|
},
|
|
69
69
|
{
|
|
70
70
|
"test name": "1,000 morris",
|
|
71
|
-
"time taken (ms)": "37.
|
|
72
|
-
"executions per sec": "26.
|
|
73
|
-
"sample deviation": "
|
|
71
|
+
"time taken (ms)": "37.29",
|
|
72
|
+
"executions per sec": "26.81",
|
|
73
|
+
"sample deviation": "3.77e-4"
|
|
74
74
|
}
|
|
75
75
|
],
|
|
76
76
|
"testName": "binary-tree"
|
|
@@ -79,27 +79,27 @@
|
|
|
79
79
|
"benchmarks": [
|
|
80
80
|
{
|
|
81
81
|
"test name": "10,000 add randomly",
|
|
82
|
-
"time taken (ms)": "
|
|
83
|
-
"executions per sec": "
|
|
82
|
+
"time taken (ms)": "31.58",
|
|
83
|
+
"executions per sec": "31.67",
|
|
84
84
|
"sample deviation": "0.00"
|
|
85
85
|
},
|
|
86
86
|
{
|
|
87
87
|
"test name": "10,000 add & delete randomly",
|
|
88
|
-
"time taken (ms)": "
|
|
89
|
-
"executions per sec": "14.
|
|
90
|
-
"sample deviation": "8.
|
|
88
|
+
"time taken (ms)": "71.09",
|
|
89
|
+
"executions per sec": "14.07",
|
|
90
|
+
"sample deviation": "8.99e-4"
|
|
91
91
|
},
|
|
92
92
|
{
|
|
93
93
|
"test name": "10,000 addMany",
|
|
94
|
-
"time taken (ms)": "29.
|
|
95
|
-
"executions per sec": "
|
|
96
|
-
"sample deviation": "
|
|
94
|
+
"time taken (ms)": "29.68",
|
|
95
|
+
"executions per sec": "33.69",
|
|
96
|
+
"sample deviation": "0.00"
|
|
97
97
|
},
|
|
98
98
|
{
|
|
99
99
|
"test name": "10,000 get",
|
|
100
|
-
"time taken (ms)": "28.
|
|
101
|
-
"executions per sec": "35.
|
|
102
|
-
"sample deviation": "
|
|
100
|
+
"time taken (ms)": "28.55",
|
|
101
|
+
"executions per sec": "35.03",
|
|
102
|
+
"sample deviation": "0.00"
|
|
103
103
|
}
|
|
104
104
|
],
|
|
105
105
|
"testName": "bst"
|
|
@@ -108,21 +108,21 @@
|
|
|
108
108
|
"benchmarks": [
|
|
109
109
|
{
|
|
110
110
|
"test name": "100,000 add randomly",
|
|
111
|
-
"time taken (ms)": "
|
|
112
|
-
"executions per sec": "
|
|
111
|
+
"time taken (ms)": "84.64",
|
|
112
|
+
"executions per sec": "11.82",
|
|
113
113
|
"sample deviation": "0.01"
|
|
114
114
|
},
|
|
115
115
|
{
|
|
116
116
|
"test name": "100,000 add & 1000 delete randomly",
|
|
117
|
-
"time taken (ms)": "
|
|
118
|
-
"executions per sec": "
|
|
119
|
-
"sample deviation": "0.
|
|
117
|
+
"time taken (ms)": "81.32",
|
|
118
|
+
"executions per sec": "12.30",
|
|
119
|
+
"sample deviation": "0.01"
|
|
120
120
|
},
|
|
121
121
|
{
|
|
122
122
|
"test name": "100,000 getNode",
|
|
123
|
-
"time taken (ms)": "
|
|
124
|
-
"executions per sec": "
|
|
125
|
-
"sample deviation": "0.
|
|
123
|
+
"time taken (ms)": "61.18",
|
|
124
|
+
"executions per sec": "16.35",
|
|
125
|
+
"sample deviation": "0.00"
|
|
126
126
|
}
|
|
127
127
|
],
|
|
128
128
|
"testName": "rb-tree"
|
|
@@ -132,43 +132,43 @@
|
|
|
132
132
|
{
|
|
133
133
|
"test name": "1,000 addVertex",
|
|
134
134
|
"time taken (ms)": "0.10",
|
|
135
|
-
"executions per sec": "
|
|
136
|
-
"sample deviation": "
|
|
135
|
+
"executions per sec": "9637.47",
|
|
136
|
+
"sample deviation": "3.79e-6"
|
|
137
137
|
},
|
|
138
138
|
{
|
|
139
139
|
"test name": "1,000 addEdge",
|
|
140
|
-
"time taken (ms)": "
|
|
141
|
-
"executions per sec": "
|
|
142
|
-
"sample deviation": "
|
|
140
|
+
"time taken (ms)": "6.09",
|
|
141
|
+
"executions per sec": "164.18",
|
|
142
|
+
"sample deviation": "1.31e-4"
|
|
143
143
|
},
|
|
144
144
|
{
|
|
145
145
|
"test name": "1,000 getVertex",
|
|
146
146
|
"time taken (ms)": "0.05",
|
|
147
|
-
"executions per sec": "2.
|
|
148
|
-
"sample deviation": "
|
|
147
|
+
"executions per sec": "2.14e+4",
|
|
148
|
+
"sample deviation": "1.35e-6"
|
|
149
149
|
},
|
|
150
150
|
{
|
|
151
151
|
"test name": "1,000 getEdge",
|
|
152
|
-
"time taken (ms)": "
|
|
153
|
-
"executions per sec": "
|
|
154
|
-
"sample deviation": "0.
|
|
152
|
+
"time taken (ms)": "23.91",
|
|
153
|
+
"executions per sec": "41.82",
|
|
154
|
+
"sample deviation": "0.01"
|
|
155
155
|
},
|
|
156
156
|
{
|
|
157
157
|
"test name": "tarjan",
|
|
158
|
-
"time taken (ms)": "
|
|
159
|
-
"executions per sec": "
|
|
158
|
+
"time taken (ms)": "218.65",
|
|
159
|
+
"executions per sec": "4.57",
|
|
160
160
|
"sample deviation": "0.01"
|
|
161
161
|
},
|
|
162
162
|
{
|
|
163
163
|
"test name": "tarjan all",
|
|
164
|
-
"time taken (ms)": "
|
|
165
|
-
"executions per sec": "
|
|
164
|
+
"time taken (ms)": "221.67",
|
|
165
|
+
"executions per sec": "4.51",
|
|
166
166
|
"sample deviation": "0.00"
|
|
167
167
|
},
|
|
168
168
|
{
|
|
169
169
|
"test name": "topologicalSort",
|
|
170
|
-
"time taken (ms)": "
|
|
171
|
-
"executions per sec": "
|
|
170
|
+
"time taken (ms)": "184.34",
|
|
171
|
+
"executions per sec": "5.42",
|
|
172
172
|
"sample deviation": "0.02"
|
|
173
173
|
}
|
|
174
174
|
],
|
|
@@ -178,15 +178,15 @@
|
|
|
178
178
|
"benchmarks": [
|
|
179
179
|
{
|
|
180
180
|
"test name": "10,000 add & pop",
|
|
181
|
-
"time taken (ms)": "4.
|
|
182
|
-
"executions per sec": "
|
|
183
|
-
"sample deviation": "
|
|
181
|
+
"time taken (ms)": "4.63",
|
|
182
|
+
"executions per sec": "215.77",
|
|
183
|
+
"sample deviation": "4.49e-5"
|
|
184
184
|
},
|
|
185
185
|
{
|
|
186
186
|
"test name": "10,000 fib add & pop",
|
|
187
|
-
"time taken (ms)": "
|
|
188
|
-
"executions per sec": "2.
|
|
189
|
-
"sample deviation": "0.
|
|
187
|
+
"time taken (ms)": "355.19",
|
|
188
|
+
"executions per sec": "2.82",
|
|
189
|
+
"sample deviation": "0.00"
|
|
190
190
|
}
|
|
191
191
|
],
|
|
192
192
|
"testName": "heap"
|
|
@@ -195,21 +195,21 @@
|
|
|
195
195
|
"benchmarks": [
|
|
196
196
|
{
|
|
197
197
|
"test name": "1,000,000 unshift",
|
|
198
|
-
"time taken (ms)": "
|
|
199
|
-
"executions per sec": "4.
|
|
200
|
-
"sample deviation": "0.
|
|
198
|
+
"time taken (ms)": "213.53",
|
|
199
|
+
"executions per sec": "4.68",
|
|
200
|
+
"sample deviation": "0.02"
|
|
201
201
|
},
|
|
202
202
|
{
|
|
203
203
|
"test name": "1,000,000 unshift & shift",
|
|
204
|
-
"time taken (ms)": "
|
|
205
|
-
"executions per sec": "6.
|
|
206
|
-
"sample deviation": "0.
|
|
204
|
+
"time taken (ms)": "162.97",
|
|
205
|
+
"executions per sec": "6.14",
|
|
206
|
+
"sample deviation": "0.02"
|
|
207
207
|
},
|
|
208
208
|
{
|
|
209
209
|
"test name": "1,000,000 insertBefore",
|
|
210
|
-
"time taken (ms)": "
|
|
211
|
-
"executions per sec": "2.
|
|
212
|
-
"sample deviation": "0.
|
|
210
|
+
"time taken (ms)": "335.19",
|
|
211
|
+
"executions per sec": "2.98",
|
|
212
|
+
"sample deviation": "0.09"
|
|
213
213
|
}
|
|
214
214
|
],
|
|
215
215
|
"testName": "doubly-linked-list"
|
|
@@ -218,15 +218,15 @@
|
|
|
218
218
|
"benchmarks": [
|
|
219
219
|
{
|
|
220
220
|
"test name": "10,000 push & pop",
|
|
221
|
-
"time taken (ms)": "
|
|
222
|
-
"executions per sec": "4.
|
|
223
|
-
"sample deviation": "0.
|
|
221
|
+
"time taken (ms)": "231.35",
|
|
222
|
+
"executions per sec": "4.32",
|
|
223
|
+
"sample deviation": "0.02"
|
|
224
224
|
},
|
|
225
225
|
{
|
|
226
226
|
"test name": "10,000 insertBefore",
|
|
227
|
-
"time taken (ms)": "
|
|
228
|
-
"executions per sec": "
|
|
229
|
-
"sample deviation": "0.
|
|
227
|
+
"time taken (ms)": "251.49",
|
|
228
|
+
"executions per sec": "3.98",
|
|
229
|
+
"sample deviation": "0.01"
|
|
230
230
|
}
|
|
231
231
|
],
|
|
232
232
|
"testName": "singly-linked-list"
|
|
@@ -235,9 +235,9 @@
|
|
|
235
235
|
"benchmarks": [
|
|
236
236
|
{
|
|
237
237
|
"test name": "10,000 refill & poll",
|
|
238
|
-
"time taken (ms)": "11.
|
|
239
|
-
"executions per sec": "
|
|
240
|
-
"sample deviation": "
|
|
238
|
+
"time taken (ms)": "11.48",
|
|
239
|
+
"executions per sec": "87.14",
|
|
240
|
+
"sample deviation": "1.91e-4"
|
|
241
241
|
}
|
|
242
242
|
],
|
|
243
243
|
"testName": "max-priority-queue"
|
|
@@ -246,14 +246,14 @@
|
|
|
246
246
|
"benchmarks": [
|
|
247
247
|
{
|
|
248
248
|
"test name": "1,000,000 push",
|
|
249
|
-
"time taken (ms)": "
|
|
250
|
-
"executions per sec": "4.
|
|
251
|
-
"sample deviation": "0.
|
|
249
|
+
"time taken (ms)": "215.14",
|
|
250
|
+
"executions per sec": "4.65",
|
|
251
|
+
"sample deviation": "0.05"
|
|
252
252
|
},
|
|
253
253
|
{
|
|
254
254
|
"test name": "1,000,000 shift",
|
|
255
255
|
"time taken (ms)": "25.15",
|
|
256
|
-
"executions per sec": "39.
|
|
256
|
+
"executions per sec": "39.76",
|
|
257
257
|
"sample deviation": "0.00"
|
|
258
258
|
}
|
|
259
259
|
],
|
|
@@ -263,14 +263,14 @@
|
|
|
263
263
|
"benchmarks": [
|
|
264
264
|
{
|
|
265
265
|
"test name": "1,000,000 push",
|
|
266
|
-
"time taken (ms)": "
|
|
267
|
-
"executions per sec": "22.
|
|
266
|
+
"time taken (ms)": "44.15",
|
|
267
|
+
"executions per sec": "22.65",
|
|
268
268
|
"sample deviation": "0.01"
|
|
269
269
|
},
|
|
270
270
|
{
|
|
271
271
|
"test name": "1,000,000 push & shift",
|
|
272
|
-
"time taken (ms)": "
|
|
273
|
-
"executions per sec": "12.
|
|
272
|
+
"time taken (ms)": "80.87",
|
|
273
|
+
"executions per sec": "12.37",
|
|
274
274
|
"sample deviation": "0.00"
|
|
275
275
|
}
|
|
276
276
|
],
|
|
@@ -280,15 +280,15 @@
|
|
|
280
280
|
"benchmarks": [
|
|
281
281
|
{
|
|
282
282
|
"test name": "100,000 push",
|
|
283
|
-
"time taken (ms)": "
|
|
284
|
-
"executions per sec": "16.
|
|
285
|
-
"sample deviation": "0.
|
|
283
|
+
"time taken (ms)": "61.38",
|
|
284
|
+
"executions per sec": "16.29",
|
|
285
|
+
"sample deviation": "0.01"
|
|
286
286
|
},
|
|
287
287
|
{
|
|
288
288
|
"test name": "100,000 getWords",
|
|
289
|
-
"time taken (ms)": "
|
|
290
|
-
"executions per sec": "9.
|
|
291
|
-
"sample deviation": "0.
|
|
289
|
+
"time taken (ms)": "104.27",
|
|
290
|
+
"executions per sec": "9.59",
|
|
291
|
+
"sample deviation": "0.02"
|
|
292
292
|
}
|
|
293
293
|
],
|
|
294
294
|
"testName": "trie"
|
|
@@ -79,7 +79,6 @@ export declare class BinaryTree<V = any, N extends BinaryTreeNode<V, N> = Binary
|
|
|
79
79
|
* Get the number of nodes in the binary tree.
|
|
80
80
|
*/
|
|
81
81
|
get size(): number;
|
|
82
|
-
protected defaultOneParamCallback: (node: N) => number;
|
|
83
82
|
/**
|
|
84
83
|
* Creates a new instance of BinaryTreeNode with the given key and value.
|
|
85
84
|
* @param {BTNKey} key - The key for the new node.
|
|
@@ -289,6 +288,7 @@ export declare class BinaryTree<V = any, N extends BinaryTreeNode<V, N> = Binary
|
|
|
289
288
|
* binary tree nodes in a specific order.
|
|
290
289
|
*/
|
|
291
290
|
[Symbol.iterator](node?: N | null): Generator<BTNKey, void, undefined>;
|
|
291
|
+
protected defaultOneParamCallback: (node: N) => number;
|
|
292
292
|
/**
|
|
293
293
|
* Swap the data of two nodes in the binary tree.
|
|
294
294
|
* @param {N} srcNode - The source node to swap.
|
|
@@ -1034,7 +1034,6 @@ class BinaryTree {
|
|
|
1034
1034
|
}
|
|
1035
1035
|
return y;
|
|
1036
1036
|
}
|
|
1037
|
-
// --- start additional methods ---
|
|
1038
1037
|
/**
|
|
1039
1038
|
* The `morris` function performs a depth-first traversal of a binary tree using the Morris traversal
|
|
1040
1039
|
* algorithm and returns an array of values obtained by applying a callback function to each node.
|
|
@@ -1133,6 +1132,7 @@ class BinaryTree {
|
|
|
1133
1132
|
}
|
|
1134
1133
|
return ans;
|
|
1135
1134
|
}
|
|
1135
|
+
// --- start additional methods ---
|
|
1136
1136
|
/**
|
|
1137
1137
|
* The above function is an iterator for a binary tree that can be used to traverse the tree in
|
|
1138
1138
|
* either an iterative or recursive manner.
|