data-structure-typed 1.51.3 → 1.51.4
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/POSTS_zh-CN.md +54 -0
- package/README.md +3 -0
- package/benchmark/report.html +1 -37
- package/benchmark/report.json +3 -405
- package/dist/cjs/data-structures/binary-tree/binary-tree.js +2 -2
- package/dist/cjs/data-structures/binary-tree/binary-tree.js.map +1 -1
- package/dist/cjs/data-structures/binary-tree/bst.js +1 -1
- package/dist/cjs/data-structures/binary-tree/bst.js.map +1 -1
- package/dist/cjs/data-structures/index.d.ts +1 -1
- package/dist/cjs/data-structures/index.js +1 -1
- package/dist/cjs/data-structures/index.js.map +1 -1
- package/dist/cjs/utils/index.d.ts +1 -0
- package/dist/cjs/utils/index.js +1 -0
- package/dist/cjs/utils/index.js.map +1 -1
- package/dist/cjs/utils/number.d.ts +1 -0
- package/dist/cjs/utils/number.js +12 -0
- package/dist/cjs/utils/number.js.map +1 -0
- package/dist/mjs/data-structures/binary-tree/binary-tree.js +2 -2
- package/dist/mjs/data-structures/binary-tree/bst.js +1 -1
- package/dist/mjs/data-structures/index.d.ts +1 -1
- package/dist/mjs/data-structures/index.js +1 -1
- package/dist/mjs/utils/index.d.ts +1 -0
- package/dist/mjs/utils/index.js +1 -0
- package/dist/mjs/utils/number.d.ts +1 -0
- package/dist/mjs/utils/number.js +7 -0
- package/dist/umd/data-structure-typed.js +116 -108
- package/dist/umd/data-structure-typed.min.js +2 -2
- package/dist/umd/data-structure-typed.min.js.map +1 -1
- package/package.json +6 -6
- package/src/data-structures/binary-tree/binary-tree.ts +2 -2
- package/src/data-structures/binary-tree/bst.ts +1 -1
- package/src/data-structures/index.ts +1 -1
- package/src/utils/index.ts +1 -0
- package/src/utils/number.ts +9 -0
- package/test/performance/data-structures/tree/tree.test.ts +0 -0
- package/test/unit/data-structures/tree/tree.test.ts +0 -39
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.51.
|
|
11
|
+
## [v1.51.4](https://github.com/zrwusa/data-structure-typed/compare/v1.35.0...main) (upcoming)
|
|
12
12
|
|
|
13
13
|
### Changes
|
|
14
14
|
|
package/POSTS_zh-CN.md
ADDED
|
@@ -0,0 +1,54 @@
|
|
|
1
|
+
Java有java.utils,C++有STL,那JavaScript和TypeScript长期以来没有一个顺手的数据结构和算法库
|
|
2
|
+
|
|
3
|
+
data-structure-typed就应运而生
|
|
4
|
+
|
|
5
|
+
## 性能
|
|
6
|
+
|
|
7
|
+
### 部分超越JavaScript内置的数据结构
|
|
8
|
+
|
|
9
|
+
### 部分超越C++
|
|
10
|
+
|
|
11
|
+
|
|
12
|
+
## 顺手程度
|
|
13
|
+
|
|
14
|
+
### 亲密拥抱JavaScript,TypeScript和ES6
|
|
15
|
+
|
|
16
|
+
#### 提供与JavaScript中Array完全一致的API体验
|
|
17
|
+
|
|
18
|
+
#### 提供生成器
|
|
19
|
+
|
|
20
|
+
|
|
21
|
+
### 基类中统一实现通用方法
|
|
22
|
+
|
|
23
|
+
### 完整的OOP封装
|
|
24
|
+
|
|
25
|
+
#### 可复用性
|
|
26
|
+
|
|
27
|
+
#### 可扩展性
|
|
28
|
+
|
|
29
|
+
为开发者提供继承所有数据结构的可能
|
|
30
|
+
|
|
31
|
+
### 摒弃以往数据结构库中同时存在Set和Map
|
|
32
|
+
|
|
33
|
+
#### 原滋原味的基础数据结构
|
|
34
|
+
|
|
35
|
+
不必分别记忆Set和Map的API
|
|
36
|
+
|
|
37
|
+
|
|
38
|
+
## 内置算法
|
|
39
|
+
|
|
40
|
+
## 可视化
|
|
41
|
+
|
|
42
|
+
### print方法
|
|
43
|
+
|
|
44
|
+
### 可视化工具
|
|
45
|
+
|
|
46
|
+
#### 数据结构可视化
|
|
47
|
+
|
|
48
|
+
#### 步进式调试
|
|
49
|
+
|
|
50
|
+
## 多种模块系统的支持
|
|
51
|
+
|
|
52
|
+
|
|
53
|
+
|
|
54
|
+
|
package/README.md
CHANGED
|
@@ -291,6 +291,7 @@ We provide data structures that are not available in JS/TS
|
|
|
291
291
|
<td><img src="https://raw.githubusercontent.com/zrwusa/assets/master/images/data-structure-typed/assets/tick.svg" alt=""></td>
|
|
292
292
|
<td><img src="https://raw.githubusercontent.com/zrwusa/assets/master/images/data-structure-typed/assets/tick.svg" alt=""></td>
|
|
293
293
|
<td><a href="https://data-structure-typed-docs.vercel.app/classes/HashMap.html"><span>View</span></a></td>
|
|
294
|
+
<td><a href="https://www.npmjs.com/package/hashmap-typed"><span></span></a></td>
|
|
294
295
|
</tr>
|
|
295
296
|
<tr>
|
|
296
297
|
<td>Linked List</td>
|
|
@@ -325,12 +326,14 @@ We provide data structures that are not available in JS/TS
|
|
|
325
326
|
<td><img src="https://raw.githubusercontent.com/zrwusa/assets/master/images/data-structure-typed/assets/tick.svg" alt=""></td>
|
|
326
327
|
<td></td>
|
|
327
328
|
<td><a href="https://data-structure-typed-docs.vercel.app/classes/SegmentTree.html"><span>View</span></a></td>
|
|
329
|
+
<td><a href="https://www.npmjs.com/package/segment-tree-typed"><span></span></a></td>
|
|
328
330
|
</tr>
|
|
329
331
|
<tr>
|
|
330
332
|
<td>Binary Indexed Tree</td>
|
|
331
333
|
<td><img src="https://raw.githubusercontent.com/zrwusa/assets/master/images/data-structure-typed/assets/tick.svg" alt=""></td>
|
|
332
334
|
<td></td>
|
|
333
335
|
<td><a href="https://data-structure-typed-docs.vercel.app/classes/BinaryIndexedTree.html"><span>View</span></a></td>
|
|
336
|
+
<td><a href="https://www.npmjs.com/package/binary-indexed-tree-typed"><span></span></a></td>
|
|
334
337
|
</tr>
|
|
335
338
|
</tbody>
|
|
336
339
|
</table>
|
package/benchmark/report.html
CHANGED
|
@@ -42,44 +42,8 @@
|
|
|
42
42
|
</head>
|
|
43
43
|
<body>
|
|
44
44
|
<div id="json-to-html"><div class="json-to-html-collapse clearfix 0">
|
|
45
|
-
<div class='collapsible level0' ><span class='json-to-html-label'>heap</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>100,000 add</td><td>6.44</td><td>155.39</td><td>1.89e-4</td></tr><tr><td>100,000 add & poll</td><td>31.54</td><td>31.71</td><td>7.91e-4</td></tr></table></div>
|
|
47
|
-
</div><div class="json-to-html-collapse clearfix 0">
|
|
48
|
-
<div class='collapsible level0' ><span class='json-to-html-label'>rb-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>100,000 add</td><td>55.64</td><td>17.97</td><td>3.93e-4</td></tr><tr><td>100,000 add randomly</td><td>70.35</td><td>14.21</td><td>0.00</td></tr><tr><td>100,000 get</td><td>115.51</td><td>8.66</td><td>0.00</td></tr><tr><td>100,000 iterator</td><td>27.64</td><td>36.18</td><td>0.01</td></tr><tr><td>100,000 add & delete orderly</td><td>120.73</td><td>8.28</td><td>0.00</td></tr><tr><td>100,000 add & delete randomly</td><td>223.37</td><td>4.48</td><td>0.00</td></tr></table></div>
|
|
50
|
-
</div><div class="json-to-html-collapse clearfix 0">
|
|
51
|
-
<div class='collapsible level0' ><span class='json-to-html-label'>queue</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>1,000,000 push</td><td>42.87</td><td>23.33</td><td>0.01</td></tr><tr><td>100,000 push & shift</td><td>4.87</td><td>205.17</td><td>6.94e-4</td></tr><tr><td>Native JS Array 100,000 push & shift</td><td>2196.84</td><td>0.46</td><td>0.19</td></tr></table></div>
|
|
53
|
-
</div><div class="json-to-html-collapse clearfix 0">
|
|
54
|
-
<div class='collapsible level0' ><span class='json-to-html-label'>deque</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>1,000,000 push</td><td>23.68</td><td>42.22</td><td>0.00</td></tr><tr><td>1,000,000 push & pop</td><td>30.68</td><td>32.60</td><td>0.00</td></tr><tr><td>1,000,000 push & shift</td><td>30.49</td><td>32.80</td><td>0.00</td></tr><tr><td>100,000 push & shift</td><td>3.21</td><td>311.51</td><td>2.41e-4</td></tr><tr><td>Native JS Array 100,000 push & shift</td><td>2510.08</td><td>0.40</td><td>0.34</td></tr><tr><td>100,000 unshift & shift</td><td>2.89</td><td>346.57</td><td>2.98e-4</td></tr><tr><td>Native JS Array 100,000 unshift & shift</td><td>4581.65</td><td>0.22</td><td>0.40</td></tr></table></div>
|
|
56
|
-
</div><div class="json-to-html-collapse clearfix 0">
|
|
57
|
-
<div class='collapsible level0' ><span class='json-to-html-label'>hash-map</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,000 set</td><td>120.66</td><td>8.29</td><td>0.03</td></tr><tr><td>Native JS Map 1,000,000 set</td><td>202.57</td><td>4.94</td><td>0.01</td></tr><tr><td>Native JS Set 1,000,000 add</td><td>167.46</td><td>5.97</td><td>0.01</td></tr><tr><td>1,000,000 set & get</td><td>115.60</td><td>8.65</td><td>0.01</td></tr><tr><td>Native JS Map 1,000,000 set & get</td><td>265.34</td><td>3.77</td><td>0.01</td></tr><tr><td>Native JS Set 1,000,000 add & has</td><td>167.85</td><td>5.96</td><td>0.01</td></tr><tr><td>1,000,000 ObjKey set & get</td><td>308.73</td><td>3.24</td><td>0.03</td></tr><tr><td>Native JS Map 1,000,000 ObjKey set & get</td><td>300.60</td><td>3.33</td><td>0.03</td></tr><tr><td>Native JS Set 1,000,000 ObjKey add & has</td><td>270.49</td><td>3.70</td><td>0.04</td></tr></table></div>
|
|
59
|
-
</div><div class="json-to-html-collapse clearfix 0">
|
|
60
|
-
<div class='collapsible level0' ><span class='json-to-html-label'>trie</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>100,000 push</td><td>45.79</td><td>21.84</td><td>7.32e-4</td></tr><tr><td>100,000 getWords</td><td>87.85</td><td>11.38</td><td>0.00</td></tr></table></div>
|
|
62
|
-
</div><div class="json-to-html-collapse clearfix 0">
|
|
63
45
|
<div class='collapsible level0' ><span class='json-to-html-label'>avl-tree</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>100,000 add
|
|
65
|
-
</div><div class="json-to-html-collapse clearfix 0">
|
|
66
|
-
<div class='collapsible level0' ><span class='json-to-html-label'>binary-tree-overall</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 RBTree add</td><td>5.74</td><td>174.10</td><td>9.29e-5</td></tr><tr><td>10,000 RBTree add & delete randomly</td><td>18.83</td><td>53.10</td><td>1.49e-4</td></tr><tr><td>10,000 RBTree get</td><td>0.77</td><td>1290.55</td><td>7.33e-6</td></tr><tr><td>10,000 AVLTree add</td><td>22.60</td><td>44.25</td><td>2.14e-4</td></tr><tr><td>10,000 AVLTree get</td><td>10.63</td><td>94.08</td><td>1.02e-4</td></tr><tr><td>10,000 AVLTree add & delete randomly</td><td>44.17</td><td>22.64</td><td>3.52e-4</td></tr></table></div>
|
|
68
|
-
</div><div class="json-to-html-collapse clearfix 0">
|
|
69
|
-
<div class='collapsible level0' ><span class='json-to-html-label'>directed-graph</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>1,000 addVertex</td><td>0.11</td><td>9501.69</td><td>1.02e-6</td></tr><tr><td>1,000 addEdge</td><td>6.18</td><td>161.81</td><td>4.27e-4</td></tr><tr><td>1,000 getVertex</td><td>0.05</td><td>2.16e+4</td><td>3.23e-7</td></tr><tr><td>1,000 getEdge</td><td>23.31</td><td>42.90</td><td>0.00</td></tr><tr><td>tarjan</td><td>206.06</td><td>4.85</td><td>0.01</td></tr><tr><td>topologicalSort</td><td>181.65</td><td>5.51</td><td>0.01</td></tr></table></div>
|
|
71
|
-
</div><div class="json-to-html-collapse clearfix 0">
|
|
72
|
-
<div class='collapsible level0' ><span class='json-to-html-label'>doubly-linked-list</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>207.88</td><td>4.81</td><td>0.04</td></tr><tr><td>1,000,000 unshift</td><td>214.33</td><td>4.67</td><td>0.06</td></tr><tr><td>1,000,000 unshift & shift</td><td>185.54</td><td>5.39</td><td>0.04</td></tr><tr><td>1,000,000 addBefore</td><td>308.66</td><td>3.24</td><td>0.08</td></tr></table></div>
|
|
74
|
-
</div><div class="json-to-html-collapse clearfix 0">
|
|
75
|
-
<div class='collapsible level0' ><span class='json-to-html-label'>singly-linked-list</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 & shift</td><td>202.61</td><td>4.94</td><td>0.04</td></tr><tr><td>10,000 push & pop</td><td>219.69</td><td>4.55</td><td>0.02</td></tr><tr><td>10,000 addBefore</td><td>247.13</td><td>4.05</td><td>0.01</td></tr></table></div>
|
|
77
|
-
</div><div class="json-to-html-collapse clearfix 0">
|
|
78
|
-
<div class='collapsible level0' ><span class='json-to-html-label'>priority-queue</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 add</td><td>27.36</td><td>36.55</td><td>9.92e-4</td></tr><tr><td>100,000 add & poll</td><td>146.72</td><td>6.82</td><td>6.84e-4</td></tr></table></div>
|
|
80
|
-
</div><div class="json-to-html-collapse clearfix 0">
|
|
81
|
-
<div class='collapsible level0' ><span class='json-to-html-label'>stack</span></div>
|
|
82
|
-
<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>39.36</td><td>25.41</td><td>0.01</td></tr><tr><td>1,000,000 push & pop</td><td>47.86</td><td>20.89</td><td>0.01</td></tr></table></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>100,000 add & delete orderly</td><td>0.00e+0</td><td>0.00e+0</td><td>0.00e+0</td></tr></table></div>
|
|
83
47
|
</div>
|
|
84
48
|
|
|
85
49
|
</div>
|
package/benchmark/report.json
CHANGED
|
@@ -1,415 +1,13 @@
|
|
|
1
1
|
{
|
|
2
|
-
"heap": {
|
|
3
|
-
"benchmarks": [
|
|
4
|
-
{
|
|
5
|
-
"test name": "100,000 add",
|
|
6
|
-
"time taken (ms)": "6.44",
|
|
7
|
-
"executions per sec": "155.39",
|
|
8
|
-
"sample deviation": "1.89e-4"
|
|
9
|
-
},
|
|
10
|
-
{
|
|
11
|
-
"test name": "100,000 add & poll",
|
|
12
|
-
"time taken (ms)": "31.54",
|
|
13
|
-
"executions per sec": "31.71",
|
|
14
|
-
"sample deviation": "7.91e-4"
|
|
15
|
-
}
|
|
16
|
-
],
|
|
17
|
-
"testName": "heap"
|
|
18
|
-
},
|
|
19
|
-
"rb-tree": {
|
|
20
|
-
"benchmarks": [
|
|
21
|
-
{
|
|
22
|
-
"test name": "100,000 add",
|
|
23
|
-
"time taken (ms)": "55.64",
|
|
24
|
-
"executions per sec": "17.97",
|
|
25
|
-
"sample deviation": "3.93e-4"
|
|
26
|
-
},
|
|
27
|
-
{
|
|
28
|
-
"test name": "100,000 add randomly",
|
|
29
|
-
"time taken (ms)": "70.35",
|
|
30
|
-
"executions per sec": "14.21",
|
|
31
|
-
"sample deviation": "0.00"
|
|
32
|
-
},
|
|
33
|
-
{
|
|
34
|
-
"test name": "100,000 get",
|
|
35
|
-
"time taken (ms)": "115.51",
|
|
36
|
-
"executions per sec": "8.66",
|
|
37
|
-
"sample deviation": "0.00"
|
|
38
|
-
},
|
|
39
|
-
{
|
|
40
|
-
"test name": "100,000 iterator",
|
|
41
|
-
"time taken (ms)": "27.64",
|
|
42
|
-
"executions per sec": "36.18",
|
|
43
|
-
"sample deviation": "0.01"
|
|
44
|
-
},
|
|
45
|
-
{
|
|
46
|
-
"test name": "100,000 add & delete orderly",
|
|
47
|
-
"time taken (ms)": "120.73",
|
|
48
|
-
"executions per sec": "8.28",
|
|
49
|
-
"sample deviation": "0.00"
|
|
50
|
-
},
|
|
51
|
-
{
|
|
52
|
-
"test name": "100,000 add & delete randomly",
|
|
53
|
-
"time taken (ms)": "223.37",
|
|
54
|
-
"executions per sec": "4.48",
|
|
55
|
-
"sample deviation": "0.00"
|
|
56
|
-
}
|
|
57
|
-
],
|
|
58
|
-
"testName": "rb-tree"
|
|
59
|
-
},
|
|
60
|
-
"queue": {
|
|
61
|
-
"benchmarks": [
|
|
62
|
-
{
|
|
63
|
-
"test name": "1,000,000 push",
|
|
64
|
-
"time taken (ms)": "42.87",
|
|
65
|
-
"executions per sec": "23.33",
|
|
66
|
-
"sample deviation": "0.01"
|
|
67
|
-
},
|
|
68
|
-
{
|
|
69
|
-
"test name": "100,000 push & shift",
|
|
70
|
-
"time taken (ms)": "4.87",
|
|
71
|
-
"executions per sec": "205.17",
|
|
72
|
-
"sample deviation": "6.94e-4"
|
|
73
|
-
},
|
|
74
|
-
{
|
|
75
|
-
"test name": "Native JS Array 100,000 push & shift",
|
|
76
|
-
"time taken (ms)": "2196.84",
|
|
77
|
-
"executions per sec": "0.46",
|
|
78
|
-
"sample deviation": "0.19"
|
|
79
|
-
}
|
|
80
|
-
],
|
|
81
|
-
"testName": "queue"
|
|
82
|
-
},
|
|
83
|
-
"deque": {
|
|
84
|
-
"benchmarks": [
|
|
85
|
-
{
|
|
86
|
-
"test name": "1,000,000 push",
|
|
87
|
-
"time taken (ms)": "23.68",
|
|
88
|
-
"executions per sec": "42.22",
|
|
89
|
-
"sample deviation": "0.00"
|
|
90
|
-
},
|
|
91
|
-
{
|
|
92
|
-
"test name": "1,000,000 push & pop",
|
|
93
|
-
"time taken (ms)": "30.68",
|
|
94
|
-
"executions per sec": "32.60",
|
|
95
|
-
"sample deviation": "0.00"
|
|
96
|
-
},
|
|
97
|
-
{
|
|
98
|
-
"test name": "1,000,000 push & shift",
|
|
99
|
-
"time taken (ms)": "30.49",
|
|
100
|
-
"executions per sec": "32.80",
|
|
101
|
-
"sample deviation": "0.00"
|
|
102
|
-
},
|
|
103
|
-
{
|
|
104
|
-
"test name": "100,000 push & shift",
|
|
105
|
-
"time taken (ms)": "3.21",
|
|
106
|
-
"executions per sec": "311.51",
|
|
107
|
-
"sample deviation": "2.41e-4"
|
|
108
|
-
},
|
|
109
|
-
{
|
|
110
|
-
"test name": "Native JS Array 100,000 push & shift",
|
|
111
|
-
"time taken (ms)": "2510.08",
|
|
112
|
-
"executions per sec": "0.40",
|
|
113
|
-
"sample deviation": "0.34"
|
|
114
|
-
},
|
|
115
|
-
{
|
|
116
|
-
"test name": "100,000 unshift & shift",
|
|
117
|
-
"time taken (ms)": "2.89",
|
|
118
|
-
"executions per sec": "346.57",
|
|
119
|
-
"sample deviation": "2.98e-4"
|
|
120
|
-
},
|
|
121
|
-
{
|
|
122
|
-
"test name": "Native JS Array 100,000 unshift & shift",
|
|
123
|
-
"time taken (ms)": "4581.65",
|
|
124
|
-
"executions per sec": "0.22",
|
|
125
|
-
"sample deviation": "0.40"
|
|
126
|
-
}
|
|
127
|
-
],
|
|
128
|
-
"testName": "deque"
|
|
129
|
-
},
|
|
130
|
-
"hash-map": {
|
|
131
|
-
"benchmarks": [
|
|
132
|
-
{
|
|
133
|
-
"test name": "1,000,000 set",
|
|
134
|
-
"time taken (ms)": "120.66",
|
|
135
|
-
"executions per sec": "8.29",
|
|
136
|
-
"sample deviation": "0.03"
|
|
137
|
-
},
|
|
138
|
-
{
|
|
139
|
-
"test name": "Native JS Map 1,000,000 set",
|
|
140
|
-
"time taken (ms)": "202.57",
|
|
141
|
-
"executions per sec": "4.94",
|
|
142
|
-
"sample deviation": "0.01"
|
|
143
|
-
},
|
|
144
|
-
{
|
|
145
|
-
"test name": "Native JS Set 1,000,000 add",
|
|
146
|
-
"time taken (ms)": "167.46",
|
|
147
|
-
"executions per sec": "5.97",
|
|
148
|
-
"sample deviation": "0.01"
|
|
149
|
-
},
|
|
150
|
-
{
|
|
151
|
-
"test name": "1,000,000 set & get",
|
|
152
|
-
"time taken (ms)": "115.60",
|
|
153
|
-
"executions per sec": "8.65",
|
|
154
|
-
"sample deviation": "0.01"
|
|
155
|
-
},
|
|
156
|
-
{
|
|
157
|
-
"test name": "Native JS Map 1,000,000 set & get",
|
|
158
|
-
"time taken (ms)": "265.34",
|
|
159
|
-
"executions per sec": "3.77",
|
|
160
|
-
"sample deviation": "0.01"
|
|
161
|
-
},
|
|
162
|
-
{
|
|
163
|
-
"test name": "Native JS Set 1,000,000 add & has",
|
|
164
|
-
"time taken (ms)": "167.85",
|
|
165
|
-
"executions per sec": "5.96",
|
|
166
|
-
"sample deviation": "0.01"
|
|
167
|
-
},
|
|
168
|
-
{
|
|
169
|
-
"test name": "1,000,000 ObjKey set & get",
|
|
170
|
-
"time taken (ms)": "308.73",
|
|
171
|
-
"executions per sec": "3.24",
|
|
172
|
-
"sample deviation": "0.03"
|
|
173
|
-
},
|
|
174
|
-
{
|
|
175
|
-
"test name": "Native JS Map 1,000,000 ObjKey set & get",
|
|
176
|
-
"time taken (ms)": "300.60",
|
|
177
|
-
"executions per sec": "3.33",
|
|
178
|
-
"sample deviation": "0.03"
|
|
179
|
-
},
|
|
180
|
-
{
|
|
181
|
-
"test name": "Native JS Set 1,000,000 ObjKey add & has",
|
|
182
|
-
"time taken (ms)": "270.49",
|
|
183
|
-
"executions per sec": "3.70",
|
|
184
|
-
"sample deviation": "0.04"
|
|
185
|
-
}
|
|
186
|
-
],
|
|
187
|
-
"testName": "hash-map"
|
|
188
|
-
},
|
|
189
|
-
"trie": {
|
|
190
|
-
"benchmarks": [
|
|
191
|
-
{
|
|
192
|
-
"test name": "100,000 push",
|
|
193
|
-
"time taken (ms)": "45.79",
|
|
194
|
-
"executions per sec": "21.84",
|
|
195
|
-
"sample deviation": "7.32e-4"
|
|
196
|
-
},
|
|
197
|
-
{
|
|
198
|
-
"test name": "100,000 getWords",
|
|
199
|
-
"time taken (ms)": "87.85",
|
|
200
|
-
"executions per sec": "11.38",
|
|
201
|
-
"sample deviation": "0.00"
|
|
202
|
-
}
|
|
203
|
-
],
|
|
204
|
-
"testName": "trie"
|
|
205
|
-
},
|
|
206
2
|
"avl-tree": {
|
|
207
3
|
"benchmarks": [
|
|
208
|
-
{
|
|
209
|
-
"test name": "100,000 add",
|
|
210
|
-
"time taken (ms)": "260.78",
|
|
211
|
-
"executions per sec": "3.83",
|
|
212
|
-
"sample deviation": "0.00"
|
|
213
|
-
},
|
|
214
|
-
{
|
|
215
|
-
"test name": "100,000 add randomly",
|
|
216
|
-
"time taken (ms)": "306.61",
|
|
217
|
-
"executions per sec": "3.26",
|
|
218
|
-
"sample deviation": "0.00"
|
|
219
|
-
},
|
|
220
|
-
{
|
|
221
|
-
"test name": "100,000 get",
|
|
222
|
-
"time taken (ms)": "140.27",
|
|
223
|
-
"executions per sec": "7.13",
|
|
224
|
-
"sample deviation": "0.00"
|
|
225
|
-
},
|
|
226
|
-
{
|
|
227
|
-
"test name": "100,000 iterator",
|
|
228
|
-
"time taken (ms)": "29.90",
|
|
229
|
-
"executions per sec": "33.45",
|
|
230
|
-
"sample deviation": "0.01"
|
|
231
|
-
},
|
|
232
4
|
{
|
|
233
5
|
"test name": "100,000 add & delete orderly",
|
|
234
|
-
"time taken (ms)": "
|
|
235
|
-
"executions per sec": "
|
|
236
|
-
"sample deviation": "0.
|
|
237
|
-
},
|
|
238
|
-
{
|
|
239
|
-
"test name": "100,000 add & delete randomly",
|
|
240
|
-
"time taken (ms)": "580.74",
|
|
241
|
-
"executions per sec": "1.72",
|
|
242
|
-
"sample deviation": "0.00"
|
|
6
|
+
"time taken (ms)": "0.00e+0",
|
|
7
|
+
"executions per sec": "0.00e+0",
|
|
8
|
+
"sample deviation": "0.00e+0"
|
|
243
9
|
}
|
|
244
10
|
],
|
|
245
11
|
"testName": "avl-tree"
|
|
246
|
-
},
|
|
247
|
-
"binary-tree-overall": {
|
|
248
|
-
"benchmarks": [
|
|
249
|
-
{
|
|
250
|
-
"test name": "10,000 RBTree add",
|
|
251
|
-
"time taken (ms)": "5.74",
|
|
252
|
-
"executions per sec": "174.10",
|
|
253
|
-
"sample deviation": "9.29e-5"
|
|
254
|
-
},
|
|
255
|
-
{
|
|
256
|
-
"test name": "10,000 RBTree add & delete randomly",
|
|
257
|
-
"time taken (ms)": "18.83",
|
|
258
|
-
"executions per sec": "53.10",
|
|
259
|
-
"sample deviation": "1.49e-4"
|
|
260
|
-
},
|
|
261
|
-
{
|
|
262
|
-
"test name": "10,000 RBTree get",
|
|
263
|
-
"time taken (ms)": "0.77",
|
|
264
|
-
"executions per sec": "1290.55",
|
|
265
|
-
"sample deviation": "7.33e-6"
|
|
266
|
-
},
|
|
267
|
-
{
|
|
268
|
-
"test name": "10,000 AVLTree add",
|
|
269
|
-
"time taken (ms)": "22.60",
|
|
270
|
-
"executions per sec": "44.25",
|
|
271
|
-
"sample deviation": "2.14e-4"
|
|
272
|
-
},
|
|
273
|
-
{
|
|
274
|
-
"test name": "10,000 AVLTree get",
|
|
275
|
-
"time taken (ms)": "10.63",
|
|
276
|
-
"executions per sec": "94.08",
|
|
277
|
-
"sample deviation": "1.02e-4"
|
|
278
|
-
},
|
|
279
|
-
{
|
|
280
|
-
"test name": "10,000 AVLTree add & delete randomly",
|
|
281
|
-
"time taken (ms)": "44.17",
|
|
282
|
-
"executions per sec": "22.64",
|
|
283
|
-
"sample deviation": "3.52e-4"
|
|
284
|
-
}
|
|
285
|
-
],
|
|
286
|
-
"testName": "binary-tree-overall"
|
|
287
|
-
},
|
|
288
|
-
"directed-graph": {
|
|
289
|
-
"benchmarks": [
|
|
290
|
-
{
|
|
291
|
-
"test name": "1,000 addVertex",
|
|
292
|
-
"time taken (ms)": "0.11",
|
|
293
|
-
"executions per sec": "9501.69",
|
|
294
|
-
"sample deviation": "1.02e-6"
|
|
295
|
-
},
|
|
296
|
-
{
|
|
297
|
-
"test name": "1,000 addEdge",
|
|
298
|
-
"time taken (ms)": "6.18",
|
|
299
|
-
"executions per sec": "161.81",
|
|
300
|
-
"sample deviation": "4.27e-4"
|
|
301
|
-
},
|
|
302
|
-
{
|
|
303
|
-
"test name": "1,000 getVertex",
|
|
304
|
-
"time taken (ms)": "0.05",
|
|
305
|
-
"executions per sec": "2.16e+4",
|
|
306
|
-
"sample deviation": "3.23e-7"
|
|
307
|
-
},
|
|
308
|
-
{
|
|
309
|
-
"test name": "1,000 getEdge",
|
|
310
|
-
"time taken (ms)": "23.31",
|
|
311
|
-
"executions per sec": "42.90",
|
|
312
|
-
"sample deviation": "0.00"
|
|
313
|
-
},
|
|
314
|
-
{
|
|
315
|
-
"test name": "tarjan",
|
|
316
|
-
"time taken (ms)": "206.06",
|
|
317
|
-
"executions per sec": "4.85",
|
|
318
|
-
"sample deviation": "0.01"
|
|
319
|
-
},
|
|
320
|
-
{
|
|
321
|
-
"test name": "topologicalSort",
|
|
322
|
-
"time taken (ms)": "181.65",
|
|
323
|
-
"executions per sec": "5.51",
|
|
324
|
-
"sample deviation": "0.01"
|
|
325
|
-
}
|
|
326
|
-
],
|
|
327
|
-
"testName": "directed-graph"
|
|
328
|
-
},
|
|
329
|
-
"doubly-linked-list": {
|
|
330
|
-
"benchmarks": [
|
|
331
|
-
{
|
|
332
|
-
"test name": "1,000,000 push",
|
|
333
|
-
"time taken (ms)": "207.88",
|
|
334
|
-
"executions per sec": "4.81",
|
|
335
|
-
"sample deviation": "0.04"
|
|
336
|
-
},
|
|
337
|
-
{
|
|
338
|
-
"test name": "1,000,000 unshift",
|
|
339
|
-
"time taken (ms)": "214.33",
|
|
340
|
-
"executions per sec": "4.67",
|
|
341
|
-
"sample deviation": "0.06"
|
|
342
|
-
},
|
|
343
|
-
{
|
|
344
|
-
"test name": "1,000,000 unshift & shift",
|
|
345
|
-
"time taken (ms)": "185.54",
|
|
346
|
-
"executions per sec": "5.39",
|
|
347
|
-
"sample deviation": "0.04"
|
|
348
|
-
},
|
|
349
|
-
{
|
|
350
|
-
"test name": "1,000,000 addBefore",
|
|
351
|
-
"time taken (ms)": "308.66",
|
|
352
|
-
"executions per sec": "3.24",
|
|
353
|
-
"sample deviation": "0.08"
|
|
354
|
-
}
|
|
355
|
-
],
|
|
356
|
-
"testName": "doubly-linked-list"
|
|
357
|
-
},
|
|
358
|
-
"singly-linked-list": {
|
|
359
|
-
"benchmarks": [
|
|
360
|
-
{
|
|
361
|
-
"test name": "1,000,000 push & shift",
|
|
362
|
-
"time taken (ms)": "202.61",
|
|
363
|
-
"executions per sec": "4.94",
|
|
364
|
-
"sample deviation": "0.04"
|
|
365
|
-
},
|
|
366
|
-
{
|
|
367
|
-
"test name": "10,000 push & pop",
|
|
368
|
-
"time taken (ms)": "219.69",
|
|
369
|
-
"executions per sec": "4.55",
|
|
370
|
-
"sample deviation": "0.02"
|
|
371
|
-
},
|
|
372
|
-
{
|
|
373
|
-
"test name": "10,000 addBefore",
|
|
374
|
-
"time taken (ms)": "247.13",
|
|
375
|
-
"executions per sec": "4.05",
|
|
376
|
-
"sample deviation": "0.01"
|
|
377
|
-
}
|
|
378
|
-
],
|
|
379
|
-
"testName": "singly-linked-list"
|
|
380
|
-
},
|
|
381
|
-
"priority-queue": {
|
|
382
|
-
"benchmarks": [
|
|
383
|
-
{
|
|
384
|
-
"test name": "100,000 add",
|
|
385
|
-
"time taken (ms)": "27.36",
|
|
386
|
-
"executions per sec": "36.55",
|
|
387
|
-
"sample deviation": "9.92e-4"
|
|
388
|
-
},
|
|
389
|
-
{
|
|
390
|
-
"test name": "100,000 add & poll",
|
|
391
|
-
"time taken (ms)": "146.72",
|
|
392
|
-
"executions per sec": "6.82",
|
|
393
|
-
"sample deviation": "6.84e-4"
|
|
394
|
-
}
|
|
395
|
-
],
|
|
396
|
-
"testName": "priority-queue"
|
|
397
|
-
},
|
|
398
|
-
"stack": {
|
|
399
|
-
"benchmarks": [
|
|
400
|
-
{
|
|
401
|
-
"test name": "1,000,000 push",
|
|
402
|
-
"time taken (ms)": "39.36",
|
|
403
|
-
"executions per sec": "25.41",
|
|
404
|
-
"sample deviation": "0.01"
|
|
405
|
-
},
|
|
406
|
-
{
|
|
407
|
-
"test name": "1,000,000 push & pop",
|
|
408
|
-
"time taken (ms)": "47.86",
|
|
409
|
-
"executions per sec": "20.89",
|
|
410
|
-
"sample deviation": "0.01"
|
|
411
|
-
}
|
|
412
|
-
],
|
|
413
|
-
"testName": "stack"
|
|
414
12
|
}
|
|
415
13
|
}
|
|
@@ -266,9 +266,9 @@ class BinaryTree extends base_1.IterableEntryBase {
|
|
|
266
266
|
* @returns a boolean value.
|
|
267
267
|
*/
|
|
268
268
|
isRealNode(node) {
|
|
269
|
-
if (
|
|
269
|
+
if (node === this.NIL || node === null || node === undefined)
|
|
270
270
|
return false;
|
|
271
|
-
return
|
|
271
|
+
return this.isNode(node);
|
|
272
272
|
}
|
|
273
273
|
/**
|
|
274
274
|
* The function checks if a given node is a BinaryTreeNode instance and has a key value of NaN.
|