data-structure-typed 1.54.2 → 2.0.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +1 -1
- package/LICENSE +2 -2
- package/README.md +14 -1
- package/README_zh-CN.md +1 -1
- package/benchmark/report.html +28 -1
- package/benchmark/report.json +327 -18
- package/dist/cjs/data-structures/base/iterable-element-base.d.ts +14 -40
- package/dist/cjs/data-structures/base/iterable-element-base.js +14 -11
- package/dist/cjs/data-structures/base/iterable-element-base.js.map +1 -1
- package/dist/cjs/data-structures/base/linear-base.d.ts +277 -0
- package/dist/cjs/data-structures/base/linear-base.js +553 -0
- package/dist/cjs/data-structures/base/linear-base.js.map +1 -0
- package/dist/cjs/data-structures/binary-tree/avl-tree-counter.d.ts +21 -20
- package/dist/cjs/data-structures/binary-tree/avl-tree-counter.js +8 -7
- package/dist/cjs/data-structures/binary-tree/avl-tree-counter.js.map +1 -1
- package/dist/cjs/data-structures/binary-tree/avl-tree-multi-map.d.ts +23 -19
- package/dist/cjs/data-structures/binary-tree/avl-tree-multi-map.js +51 -38
- package/dist/cjs/data-structures/binary-tree/avl-tree-multi-map.js.map +1 -1
- package/dist/cjs/data-structures/binary-tree/avl-tree.d.ts +89 -21
- package/dist/cjs/data-structures/binary-tree/avl-tree.js +76 -8
- package/dist/cjs/data-structures/binary-tree/avl-tree.js.map +1 -1
- package/dist/cjs/data-structures/binary-tree/binary-tree.d.ts +173 -225
- package/dist/cjs/data-structures/binary-tree/binary-tree.js +244 -149
- package/dist/cjs/data-structures/binary-tree/binary-tree.js.map +1 -1
- package/dist/cjs/data-structures/binary-tree/bst.d.ts +62 -56
- package/dist/cjs/data-structures/binary-tree/bst.js +89 -133
- package/dist/cjs/data-structures/binary-tree/bst.js.map +1 -1
- package/dist/cjs/data-structures/binary-tree/red-black-tree.d.ts +19 -25
- package/dist/cjs/data-structures/binary-tree/red-black-tree.js +7 -13
- package/dist/cjs/data-structures/binary-tree/red-black-tree.js.map +1 -1
- package/dist/cjs/data-structures/binary-tree/tree-counter.d.ts +19 -19
- package/dist/cjs/data-structures/binary-tree/tree-counter.js +12 -12
- package/dist/cjs/data-structures/binary-tree/tree-counter.js.map +1 -1
- package/dist/cjs/data-structures/binary-tree/tree-multi-map.d.ts +186 -25
- package/dist/cjs/data-structures/binary-tree/tree-multi-map.js +211 -41
- package/dist/cjs/data-structures/binary-tree/tree-multi-map.js.map +1 -1
- package/dist/cjs/data-structures/graph/abstract-graph.js +2 -2
- package/dist/cjs/data-structures/graph/abstract-graph.js.map +1 -1
- package/dist/cjs/data-structures/heap/heap.d.ts +3 -11
- package/dist/cjs/data-structures/heap/heap.js +0 -10
- package/dist/cjs/data-structures/heap/heap.js.map +1 -1
- package/dist/cjs/data-structures/heap/max-heap.d.ts +2 -2
- package/dist/cjs/data-structures/heap/max-heap.js.map +1 -1
- package/dist/cjs/data-structures/heap/min-heap.d.ts +2 -2
- package/dist/cjs/data-structures/heap/min-heap.js.map +1 -1
- package/dist/cjs/data-structures/linked-list/doubly-linked-list.d.ts +65 -94
- package/dist/cjs/data-structures/linked-list/doubly-linked-list.js +131 -146
- package/dist/cjs/data-structures/linked-list/doubly-linked-list.js.map +1 -1
- package/dist/cjs/data-structures/linked-list/singly-linked-list.d.ts +79 -75
- package/dist/cjs/data-structures/linked-list/singly-linked-list.js +217 -169
- package/dist/cjs/data-structures/linked-list/singly-linked-list.js.map +1 -1
- package/dist/cjs/data-structures/priority-queue/max-priority-queue.d.ts +2 -2
- package/dist/cjs/data-structures/priority-queue/max-priority-queue.js.map +1 -1
- package/dist/cjs/data-structures/priority-queue/min-priority-queue.d.ts +2 -2
- package/dist/cjs/data-structures/priority-queue/min-priority-queue.js.map +1 -1
- package/dist/cjs/data-structures/priority-queue/priority-queue.d.ts +2 -2
- package/dist/cjs/data-structures/priority-queue/priority-queue.js.map +1 -1
- package/dist/cjs/data-structures/queue/deque.d.ts +130 -91
- package/dist/cjs/data-structures/queue/deque.js +269 -169
- package/dist/cjs/data-structures/queue/deque.js.map +1 -1
- package/dist/cjs/data-structures/queue/queue.d.ts +84 -40
- package/dist/cjs/data-structures/queue/queue.js +134 -50
- package/dist/cjs/data-structures/queue/queue.js.map +1 -1
- package/dist/cjs/data-structures/stack/stack.d.ts +3 -11
- package/dist/cjs/data-structures/stack/stack.js +0 -10
- package/dist/cjs/data-structures/stack/stack.js.map +1 -1
- package/dist/cjs/data-structures/trie/trie.d.ts +4 -3
- package/dist/cjs/data-structures/trie/trie.js +3 -0
- package/dist/cjs/data-structures/trie/trie.js.map +1 -1
- package/dist/cjs/types/data-structures/base/base.d.ts +9 -4
- package/dist/cjs/types/data-structures/binary-tree/avl-tree-multi-map.d.ts +1 -1
- package/dist/cjs/types/data-structures/binary-tree/binary-tree.d.ts +1 -0
- package/dist/cjs/types/data-structures/binary-tree/bst.d.ts +1 -1
- package/dist/cjs/types/data-structures/binary-tree/tree-multi-map.d.ts +1 -1
- package/dist/cjs/types/data-structures/linked-list/doubly-linked-list.d.ts +2 -2
- package/dist/cjs/types/data-structures/linked-list/singly-linked-list.d.ts +2 -2
- package/dist/cjs/types/data-structures/queue/deque.d.ts +2 -3
- package/dist/cjs/types/data-structures/queue/queue.d.ts +2 -2
- package/dist/cjs/utils/utils.d.ts +2 -2
- package/dist/esm/data-structures/base/iterable-element-base.d.ts +14 -40
- package/dist/esm/data-structures/base/iterable-element-base.js +14 -11
- package/dist/esm/data-structures/base/iterable-element-base.js.map +1 -1
- package/dist/esm/data-structures/base/linear-base.d.ts +277 -0
- package/dist/esm/data-structures/base/linear-base.js +549 -0
- package/dist/esm/data-structures/base/linear-base.js.map +1 -0
- package/dist/esm/data-structures/binary-tree/avl-tree-counter.d.ts +21 -20
- package/dist/esm/data-structures/binary-tree/avl-tree-counter.js +9 -8
- package/dist/esm/data-structures/binary-tree/avl-tree-counter.js.map +1 -1
- package/dist/esm/data-structures/binary-tree/avl-tree-multi-map.d.ts +23 -19
- package/dist/esm/data-structures/binary-tree/avl-tree-multi-map.js +52 -38
- package/dist/esm/data-structures/binary-tree/avl-tree-multi-map.js.map +1 -1
- package/dist/esm/data-structures/binary-tree/avl-tree.d.ts +89 -21
- package/dist/esm/data-structures/binary-tree/avl-tree.js +77 -9
- package/dist/esm/data-structures/binary-tree/avl-tree.js.map +1 -1
- package/dist/esm/data-structures/binary-tree/binary-tree.d.ts +173 -225
- package/dist/esm/data-structures/binary-tree/binary-tree.js +248 -153
- package/dist/esm/data-structures/binary-tree/binary-tree.js.map +1 -1
- package/dist/esm/data-structures/binary-tree/bst.d.ts +62 -56
- package/dist/esm/data-structures/binary-tree/bst.js +90 -132
- package/dist/esm/data-structures/binary-tree/bst.js.map +1 -1
- package/dist/esm/data-structures/binary-tree/red-black-tree.d.ts +19 -25
- package/dist/esm/data-structures/binary-tree/red-black-tree.js +8 -14
- package/dist/esm/data-structures/binary-tree/red-black-tree.js.map +1 -1
- package/dist/esm/data-structures/binary-tree/tree-counter.d.ts +19 -19
- package/dist/esm/data-structures/binary-tree/tree-counter.js +13 -13
- package/dist/esm/data-structures/binary-tree/tree-counter.js.map +1 -1
- package/dist/esm/data-structures/binary-tree/tree-multi-map.d.ts +186 -25
- package/dist/esm/data-structures/binary-tree/tree-multi-map.js +212 -41
- package/dist/esm/data-structures/binary-tree/tree-multi-map.js.map +1 -1
- package/dist/esm/data-structures/graph/abstract-graph.js +2 -2
- package/dist/esm/data-structures/graph/abstract-graph.js.map +1 -1
- package/dist/esm/data-structures/heap/heap.d.ts +3 -11
- package/dist/esm/data-structures/heap/heap.js +0 -10
- package/dist/esm/data-structures/heap/heap.js.map +1 -1
- package/dist/esm/data-structures/heap/max-heap.d.ts +2 -2
- package/dist/esm/data-structures/heap/max-heap.js.map +1 -1
- package/dist/esm/data-structures/heap/min-heap.d.ts +2 -2
- package/dist/esm/data-structures/heap/min-heap.js.map +1 -1
- package/dist/esm/data-structures/linked-list/doubly-linked-list.d.ts +65 -94
- package/dist/esm/data-structures/linked-list/doubly-linked-list.js +132 -148
- package/dist/esm/data-structures/linked-list/doubly-linked-list.js.map +1 -1
- package/dist/esm/data-structures/linked-list/singly-linked-list.d.ts +79 -75
- package/dist/esm/data-structures/linked-list/singly-linked-list.js +217 -170
- package/dist/esm/data-structures/linked-list/singly-linked-list.js.map +1 -1
- package/dist/esm/data-structures/priority-queue/max-priority-queue.d.ts +2 -2
- package/dist/esm/data-structures/priority-queue/max-priority-queue.js.map +1 -1
- package/dist/esm/data-structures/priority-queue/min-priority-queue.d.ts +2 -2
- package/dist/esm/data-structures/priority-queue/min-priority-queue.js.map +1 -1
- package/dist/esm/data-structures/priority-queue/priority-queue.d.ts +2 -2
- package/dist/esm/data-structures/priority-queue/priority-queue.js.map +1 -1
- package/dist/esm/data-structures/queue/deque.d.ts +130 -91
- package/dist/esm/data-structures/queue/deque.js +269 -169
- package/dist/esm/data-structures/queue/deque.js.map +1 -1
- package/dist/esm/data-structures/queue/queue.d.ts +84 -40
- package/dist/esm/data-structures/queue/queue.js +135 -51
- package/dist/esm/data-structures/queue/queue.js.map +1 -1
- package/dist/esm/data-structures/stack/stack.d.ts +3 -11
- package/dist/esm/data-structures/stack/stack.js +0 -10
- package/dist/esm/data-structures/stack/stack.js.map +1 -1
- package/dist/esm/data-structures/trie/trie.d.ts +4 -3
- package/dist/esm/data-structures/trie/trie.js +3 -0
- package/dist/esm/data-structures/trie/trie.js.map +1 -1
- package/dist/esm/types/data-structures/base/base.d.ts +9 -4
- package/dist/esm/types/data-structures/binary-tree/avl-tree-multi-map.d.ts +1 -1
- package/dist/esm/types/data-structures/binary-tree/binary-tree.d.ts +1 -0
- package/dist/esm/types/data-structures/binary-tree/bst.d.ts +1 -1
- package/dist/esm/types/data-structures/binary-tree/tree-multi-map.d.ts +1 -1
- package/dist/esm/types/data-structures/linked-list/doubly-linked-list.d.ts +2 -2
- package/dist/esm/types/data-structures/linked-list/singly-linked-list.d.ts +2 -2
- package/dist/esm/types/data-structures/queue/deque.d.ts +2 -3
- package/dist/esm/types/data-structures/queue/queue.d.ts +2 -2
- package/dist/esm/utils/utils.d.ts +2 -2
- package/dist/umd/data-structure-typed.js +1548 -920
- package/dist/umd/data-structure-typed.min.js +5 -12
- package/dist/umd/data-structure-typed.min.js.map +1 -1
- package/package.json +7 -7
- package/src/data-structures/base/iterable-element-base.ts +29 -20
- package/src/data-structures/base/linear-base.ts +649 -0
- package/src/data-structures/binary-tree/avl-tree-counter.ts +30 -23
- package/src/data-structures/binary-tree/avl-tree-multi-map.ts +74 -49
- package/src/data-structures/binary-tree/avl-tree.ts +99 -29
- package/src/data-structures/binary-tree/binary-tree.ts +474 -257
- package/src/data-structures/binary-tree/bst.ts +150 -152
- package/src/data-structures/binary-tree/red-black-tree.ts +27 -35
- package/src/data-structures/binary-tree/tree-counter.ts +33 -27
- package/src/data-structures/binary-tree/tree-multi-map.ts +235 -53
- package/src/data-structures/graph/abstract-graph.ts +2 -2
- package/src/data-structures/heap/heap.ts +3 -14
- package/src/data-structures/heap/max-heap.ts +2 -2
- package/src/data-structures/heap/min-heap.ts +2 -2
- package/src/data-structures/linked-list/doubly-linked-list.ts +144 -160
- package/src/data-structures/linked-list/singly-linked-list.ts +241 -185
- package/src/data-structures/priority-queue/max-priority-queue.ts +2 -5
- package/src/data-structures/priority-queue/min-priority-queue.ts +2 -5
- package/src/data-structures/priority-queue/priority-queue.ts +2 -2
- package/src/data-structures/queue/deque.ts +286 -183
- package/src/data-structures/queue/queue.ts +149 -63
- package/src/data-structures/stack/stack.ts +3 -18
- package/src/data-structures/trie/trie.ts +7 -3
- package/src/types/data-structures/base/base.ts +17 -8
- package/src/types/data-structures/binary-tree/avl-tree-multi-map.ts +1 -1
- package/src/types/data-structures/binary-tree/binary-tree.ts +1 -0
- package/src/types/data-structures/binary-tree/bst.ts +1 -1
- package/src/types/data-structures/binary-tree/tree-multi-map.ts +1 -1
- package/src/types/data-structures/linked-list/doubly-linked-list.ts +2 -2
- package/src/types/data-structures/linked-list/singly-linked-list.ts +2 -2
- package/src/types/data-structures/queue/deque.ts +2 -3
- package/src/types/data-structures/queue/queue.ts +2 -2
- package/src/utils/utils.ts +2 -2
- package/test/integration/all-in-one.test.ts +1 -1
- package/test/integration/avl-tree.test.ts +1 -1
- package/test/integration/bst.test.ts +2 -2
- package/test/integration/compile.mjs +21 -21
- package/test/performance/data-structures/binary-tree/avl-tree.test.mjs +71 -0
- package/test/performance/data-structures/binary-tree/red-black-tree.test.mjs +81 -0
- package/test/performance/{reportor.js → reportor.mjs} +264 -8
- package/test/performance/reportor.ts +1 -1
- package/test/unit/data-structures/binary-tree/avl-tree-counter.test.ts +7 -7
- package/test/unit/data-structures/binary-tree/avl-tree-multi-map.test.ts +172 -5
- package/test/unit/data-structures/binary-tree/avl-tree.test.ts +72 -4
- package/test/unit/data-structures/binary-tree/binary-tree.test.ts +132 -82
- package/test/unit/data-structures/binary-tree/bst.test.ts +12 -12
- package/test/unit/data-structures/binary-tree/red-black-tree.test.ts +5 -13
- package/test/unit/data-structures/binary-tree/tree-counter.test.ts +4 -4
- package/test/unit/data-structures/binary-tree/tree-multi-map.test.ts +168 -10
- package/test/unit/data-structures/linked-list/doubly-linked-list.test.ts +135 -27
- package/test/unit/data-structures/linked-list/singly-linked-list.test.ts +111 -11
- package/test/unit/data-structures/queue/deque.test.ts +241 -60
- package/test/unit/data-structures/queue/queue.test.ts +118 -19
- package/test/unit/unrestricted-interconversion.test.ts +1 -1
- package/test/utils/json2html.ts +0 -154
- package/test/performance/data-structures/binary-tree/avl-tree.test.js +0 -45
- /package/test/performance/data-structures/binary-tree/{rb-tree.test.ts → red-black-tree.test.ts} +0 -0
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
|
-
## [
|
|
11
|
+
## [v2.0.0](https://github.com/zrwusa/data-structure-typed/compare/v1.51.5...main) (upcoming)
|
|
12
12
|
|
|
13
13
|
### Changes
|
|
14
14
|
|
package/LICENSE
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
MIT License
|
|
2
2
|
|
|
3
|
-
Copyright (c) 2022
|
|
3
|
+
Copyright (c) 2022 Pablo Zeng <zrwusa@gmail.com>
|
|
4
4
|
|
|
5
5
|
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
6
|
of this software and associated documentation files (the "Software"), to deal
|
|
@@ -18,4 +18,4 @@ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
|
18
18
|
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
19
19
|
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
20
20
|
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
21
|
-
SOFTWARE.
|
|
21
|
+
SOFTWARE.
|
package/README.md
CHANGED
|
@@ -829,6 +829,19 @@ macOS Big Sur
|
|
|
829
829
|
Version 11.7.9
|
|
830
830
|
|
|
831
831
|
***Our performance testing is conducted directly on the TypeScript source code. The actual performance of the compiled JavaScript code is generally 3 times higher. We have compared it with C++, and it is only 30% slower than C++.***
|
|
832
|
+
Try it [on gitpod](https://gitpod.io#snapshot/93383de4-ca4c-4854-8c80-4359e681a96f)
|
|
833
|
+
|
|
834
|
+
Just run
|
|
835
|
+
```shell
|
|
836
|
+
pnpm perf:rbtree
|
|
837
|
+
```
|
|
838
|
+
|
|
839
|
+
```html
|
|
840
|
+
1,000,000 add randomly: 1.367s
|
|
841
|
+
1,000,000 add: 374.859ms
|
|
842
|
+
1,000,000 get: 8.025ms
|
|
843
|
+
1,000,000 getNode: 1.293s
|
|
844
|
+
```
|
|
832
845
|
|
|
833
846
|
[//]: # (No deletion!!! Start of Replace Section)
|
|
834
847
|
<div class="json-to-html-collapse clearfix 0">
|
|
@@ -1004,7 +1017,7 @@ Version 11.7.9
|
|
|
1004
1017
|
<td>Counter</td>
|
|
1005
1018
|
</tr>
|
|
1006
1019
|
<tr>
|
|
1007
|
-
<td>
|
|
1020
|
+
<td>ES6 Map<K, V></td>
|
|
1008
1021
|
<td>-</td>
|
|
1009
1022
|
<td>LinkedHashMap<K, V></td>
|
|
1010
1023
|
<td>OrderedDict</td>
|
package/README_zh-CN.md
CHANGED
|
@@ -1161,7 +1161,7 @@ avl2.print();
|
|
|
1161
1161
|
<div class='collapsible level0' ><span class='json-to-html-label'>bst</span></div>
|
|
1162
1162
|
<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>55.04</td><td>18.17</td><td>0.01</td></tr><tr><td>10,000 add & delete randomly</td><td>129.85</td><td>7.70</td><td>0.01</td></tr><tr><td>10,000 addMany</td><td>50.40</td><td>19.84</td><td>0.01</td></tr><tr><td>10,000 get</td><td>63.39</td><td>15.78</td><td>0.01</td></tr></table></div>
|
|
1163
1163
|
</div><div class="json-to-html-collapse clearfix 0">
|
|
1164
|
-
<div class='collapsible level0' ><span class='json-to-html-label'>
|
|
1164
|
+
<div class='collapsible level0' ><span class='json-to-html-label'>red-black-tree</span></div>
|
|
1165
1165
|
<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>113.25</td><td>8.83</td><td>0.02</td></tr><tr><td>100,000 add & delete randomly</td><td>305.28</td><td>3.28</td><td>0.03</td></tr><tr><td>100,000 getNode</td><td>73.20</td><td>13.66</td><td>0.03</td></tr><tr><td>100,000 add & iterator</td><td>159.80</td><td>6.26</td><td>0.06</td></tr></table></div>
|
|
1166
1166
|
</div><div class="json-to-html-collapse clearfix 0">
|
|
1167
1167
|
<div class='collapsible level0' ><span class='json-to-html-label'>comparison</span></div>
|
package/benchmark/report.html
CHANGED
|
@@ -42,8 +42,35 @@
|
|
|
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>sample mean (secs)</th><th>sample deviation</th></tr><tr><td>100,000 add</td><td>6.66</td><td>0.01</td><td>1.93e-4</td></tr><tr><td>100,000 add & poll</td><td>35.36</td><td>0.04</td><td>0.00</td></tr></table></div>
|
|
47
|
+
</div><div class="json-to-html-collapse clearfix 0">
|
|
45
48
|
<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>sample mean (secs)</th><th>sample deviation</th></tr><tr><td>100,000 add randomly</td><td>
|
|
49
|
+
<div class="content"><table style="display: table; width:100%; table-layout: fixed;"><tr><th>test name</th><th>time taken (ms)</th><th>sample mean (secs)</th><th>sample deviation</th></tr><tr><td>100,000 add randomly</td><td>548.16</td><td>0.55</td><td>0.02</td></tr><tr><td>100,000 add</td><td>503.07</td><td>0.50</td><td>0.02</td></tr><tr><td>100,000 get</td><td>0.62</td><td>6.18e-4</td><td>2.45e-4</td></tr><tr><td>100,000 getNode</td><td>326.99</td><td>0.33</td><td>0.00</td></tr><tr><td>100,000 iterator</td><td>32.01</td><td>0.03</td><td>0.00</td></tr><tr><td>100,000 add & delete orderly</td><td>809.71</td><td>0.81</td><td>0.08</td></tr><tr><td>100,000 add & delete randomly</td><td>993.95</td><td>0.99</td><td>0.03</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'>red-black-tree</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>sample mean (secs)</th><th>sample deviation</th></tr><tr><td>100,000 add randomly</td><td>159.87</td><td>0.16</td><td>0.00</td></tr><tr><td>100,000 add</td><td>218.47</td><td>0.22</td><td>3.58e-4</td></tr><tr><td>100,000 get</td><td>1.12</td><td>0.00</td><td>1.82e-4</td></tr><tr><td>100,000 getNode</td><td>511.83</td><td>0.51</td><td>0.00</td></tr><tr><td>100,000 node mode add randomly</td><td>156.83</td><td>0.16</td><td>0.00</td></tr><tr><td>100,000 node mode get</td><td>509.76</td><td>0.51</td><td>0.00</td></tr><tr><td>100,000 iterator</td><td>32.75</td><td>0.03</td><td>0.00</td></tr><tr><td>100,000 add & delete orderly</td><td>460.34</td><td>0.46</td><td>0.00</td></tr><tr><td>100,000 add & delete randomly</td><td>679.75</td><td>0.68</td><td>0.04</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'>doubly-linked-list</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>sample mean (secs)</th><th>sample deviation</th></tr><tr><td>1,000,000 push</td><td>182.03</td><td>0.18</td><td>0.02</td></tr><tr><td>1,000,000 unshift</td><td>185.94</td><td>0.19</td><td>0.03</td></tr><tr><td>1,000,000 unshift & shift</td><td>159.02</td><td>0.16</td><td>0.03</td></tr><tr><td>1,000,000 addBefore</td><td>252.73</td><td>0.25</td><td>0.03</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'>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>sample mean (secs)</th><th>sample deviation</th></tr><tr><td>1,000 addVertex</td><td>0.10</td><td>9.56e-5</td><td>9.71e-7</td></tr><tr><td>1,000 addEdge</td><td>5.97</td><td>0.01</td><td>1.99e-4</td></tr><tr><td>1,000 getVertex</td><td>0.10</td><td>9.71e-5</td><td>1.17e-6</td></tr><tr><td>1,000 getEdge</td><td>23.25</td><td>0.02</td><td>0.00</td></tr><tr><td>tarjan</td><td>192.40</td><td>0.19</td><td>0.00</td></tr><tr><td>topologicalSort</td><td>151.03</td><td>0.15</td><td>0.01</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'>queue</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>sample mean (secs)</th><th>sample deviation</th></tr><tr><td>1,000,000 push</td><td>53.79</td><td>0.05</td><td>0.02</td></tr><tr><td>100,000 push & shift</td><td>5.49</td><td>0.01</td><td>0.00</td></tr><tr><td>Native JS Array 100,000 push & shift</td><td>2358.01</td><td>2.36</td><td>0.32</td></tr></table></div>
|
|
62
|
+
</div><div class="json-to-html-collapse clearfix 0">
|
|
63
|
+
<div class='collapsible level0' ><span class='json-to-html-label'>deque</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>sample mean (secs)</th><th>sample deviation</th></tr><tr><td>1,000,000 push</td><td>23.74</td><td>0.02</td><td>0.01</td></tr><tr><td>1,000,000 push & pop</td><td>25.37</td><td>0.03</td><td>0.01</td></tr><tr><td>1,000,000 push & shift</td><td>27.61</td><td>0.03</td><td>0.01</td></tr><tr><td>100,000 push & shift</td><td>2.77</td><td>0.00</td><td>0.00</td></tr><tr><td>Native JS Array 100,000 push & shift</td><td>2430.40</td><td>2.43</td><td>0.31</td></tr><tr><td>100,000 unshift & shift</td><td>2.46</td><td>0.00</td><td>8.81e-4</td></tr><tr><td>Native JS Array 100,000 unshift & shift</td><td>4239.82</td><td>4.24</td><td>0.37</td></tr></table></div>
|
|
65
|
+
</div><div class="json-to-html-collapse clearfix 0">
|
|
66
|
+
<div class='collapsible level0' ><span class='json-to-html-label'>hash-map</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>sample mean (secs)</th><th>sample deviation</th></tr><tr><td>1,000,000 set</td><td>96.79</td><td>0.10</td><td>0.05</td></tr><tr><td>Native JS Map 1,000,000 set</td><td>230.38</td><td>0.23</td><td>0.05</td></tr><tr><td>Native JS Set 1,000,000 add</td><td>170.58</td><td>0.17</td><td>0.01</td></tr><tr><td>1,000,000 set & get</td><td>82.62</td><td>0.08</td><td>0.03</td></tr><tr><td>Native JS Map 1,000,000 set & get</td><td>278.89</td><td>0.28</td><td>0.02</td></tr><tr><td>Native JS Set 1,000,000 add & has</td><td>237.93</td><td>0.24</td><td>0.02</td></tr><tr><td>1,000,000 ObjKey set & get</td><td>369.62</td><td>0.37</td><td>0.07</td></tr><tr><td>Native JS Map 1,000,000 ObjKey set & get</td><td>332.09</td><td>0.33</td><td>0.10</td></tr><tr><td>Native JS Set 1,000,000 ObjKey add & has</td><td>271.98</td><td>0.27</td><td>0.03</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'>trie</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>sample mean (secs)</th><th>sample deviation</th></tr><tr><td>100,000 push</td><td>42.65</td><td>0.04</td><td>8.66e-4</td></tr><tr><td>100,000 getWords</td><td>83.37</td><td>0.08</td><td>0.00</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'>stack</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>sample mean (secs)</th><th>sample deviation</th></tr><tr><td>1,000,000 push</td><td>41.84</td><td>0.04</td><td>0.01</td></tr><tr><td>1,000,000 push & pop</td><td>46.56</td><td>0.05</td><td>0.01</td></tr></table></div>
|
|
47
74
|
</div>
|
|
48
75
|
|
|
49
76
|
</div>
|
package/benchmark/report.json
CHANGED
|
@@ -1,49 +1,358 @@
|
|
|
1
1
|
{
|
|
2
|
+
"heap": {
|
|
3
|
+
"benchmarks": [
|
|
4
|
+
{
|
|
5
|
+
"test name": "100,000 add",
|
|
6
|
+
"time taken (ms)": "6.66",
|
|
7
|
+
"sample mean (secs)": "0.01",
|
|
8
|
+
"sample deviation": "1.93e-4"
|
|
9
|
+
},
|
|
10
|
+
{
|
|
11
|
+
"test name": "100,000 add & poll",
|
|
12
|
+
"time taken (ms)": "35.36",
|
|
13
|
+
"sample mean (secs)": "0.04",
|
|
14
|
+
"sample deviation": "0.00"
|
|
15
|
+
}
|
|
16
|
+
],
|
|
17
|
+
"testName": "heap"
|
|
18
|
+
},
|
|
2
19
|
"avl-tree": {
|
|
3
20
|
"benchmarks": [
|
|
4
21
|
{
|
|
5
22
|
"test name": "100,000 add randomly",
|
|
6
|
-
"time taken (ms)": "
|
|
7
|
-
"sample mean (secs)": "0.
|
|
8
|
-
"sample deviation": "0.
|
|
23
|
+
"time taken (ms)": "548.16",
|
|
24
|
+
"sample mean (secs)": "0.55",
|
|
25
|
+
"sample deviation": "0.02"
|
|
9
26
|
},
|
|
10
27
|
{
|
|
11
28
|
"test name": "100,000 add",
|
|
12
|
-
"time taken (ms)": "
|
|
13
|
-
"sample mean (secs)": "0.
|
|
29
|
+
"time taken (ms)": "503.07",
|
|
30
|
+
"sample mean (secs)": "0.50",
|
|
31
|
+
"sample deviation": "0.02"
|
|
32
|
+
},
|
|
33
|
+
{
|
|
34
|
+
"test name": "100,000 get",
|
|
35
|
+
"time taken (ms)": "0.62",
|
|
36
|
+
"sample mean (secs)": "6.18e-4",
|
|
37
|
+
"sample deviation": "2.45e-4"
|
|
38
|
+
},
|
|
39
|
+
{
|
|
40
|
+
"test name": "100,000 getNode",
|
|
41
|
+
"time taken (ms)": "326.99",
|
|
42
|
+
"sample mean (secs)": "0.33",
|
|
43
|
+
"sample deviation": "0.00"
|
|
44
|
+
},
|
|
45
|
+
{
|
|
46
|
+
"test name": "100,000 iterator",
|
|
47
|
+
"time taken (ms)": "32.01",
|
|
48
|
+
"sample mean (secs)": "0.03",
|
|
49
|
+
"sample deviation": "0.00"
|
|
50
|
+
},
|
|
51
|
+
{
|
|
52
|
+
"test name": "100,000 add & delete orderly",
|
|
53
|
+
"time taken (ms)": "809.71",
|
|
54
|
+
"sample mean (secs)": "0.81",
|
|
55
|
+
"sample deviation": "0.08"
|
|
56
|
+
},
|
|
57
|
+
{
|
|
58
|
+
"test name": "100,000 add & delete randomly",
|
|
59
|
+
"time taken (ms)": "993.95",
|
|
60
|
+
"sample mean (secs)": "0.99",
|
|
61
|
+
"sample deviation": "0.03"
|
|
62
|
+
}
|
|
63
|
+
],
|
|
64
|
+
"testName": "avl-tree"
|
|
65
|
+
},
|
|
66
|
+
"red-black-tree": {
|
|
67
|
+
"benchmarks": [
|
|
68
|
+
{
|
|
69
|
+
"test name": "100,000 add randomly",
|
|
70
|
+
"time taken (ms)": "159.87",
|
|
71
|
+
"sample mean (secs)": "0.16",
|
|
14
72
|
"sample deviation": "0.00"
|
|
15
73
|
},
|
|
74
|
+
{
|
|
75
|
+
"test name": "100,000 add",
|
|
76
|
+
"time taken (ms)": "218.47",
|
|
77
|
+
"sample mean (secs)": "0.22",
|
|
78
|
+
"sample deviation": "3.58e-4"
|
|
79
|
+
},
|
|
16
80
|
{
|
|
17
81
|
"test name": "100,000 get",
|
|
18
|
-
"time taken (ms)": "
|
|
19
|
-
"sample mean (secs)": "
|
|
20
|
-
"sample deviation": "
|
|
82
|
+
"time taken (ms)": "1.12",
|
|
83
|
+
"sample mean (secs)": "0.00",
|
|
84
|
+
"sample deviation": "1.82e-4"
|
|
21
85
|
},
|
|
22
86
|
{
|
|
23
87
|
"test name": "100,000 getNode",
|
|
24
|
-
"time taken (ms)": "
|
|
25
|
-
"sample mean (secs)": "0.
|
|
26
|
-
"sample deviation": "0.
|
|
88
|
+
"time taken (ms)": "511.83",
|
|
89
|
+
"sample mean (secs)": "0.51",
|
|
90
|
+
"sample deviation": "0.00"
|
|
91
|
+
},
|
|
92
|
+
{
|
|
93
|
+
"test name": "100,000 node mode add randomly",
|
|
94
|
+
"time taken (ms)": "156.83",
|
|
95
|
+
"sample mean (secs)": "0.16",
|
|
96
|
+
"sample deviation": "0.00"
|
|
97
|
+
},
|
|
98
|
+
{
|
|
99
|
+
"test name": "100,000 node mode get",
|
|
100
|
+
"time taken (ms)": "509.76",
|
|
101
|
+
"sample mean (secs)": "0.51",
|
|
102
|
+
"sample deviation": "0.00"
|
|
27
103
|
},
|
|
28
104
|
{
|
|
29
105
|
"test name": "100,000 iterator",
|
|
30
|
-
"time taken (ms)": "
|
|
31
|
-
"sample mean (secs)": "0.
|
|
106
|
+
"time taken (ms)": "32.75",
|
|
107
|
+
"sample mean (secs)": "0.03",
|
|
32
108
|
"sample deviation": "0.00"
|
|
33
109
|
},
|
|
34
110
|
{
|
|
35
111
|
"test name": "100,000 add & delete orderly",
|
|
36
|
-
"time taken (ms)": "
|
|
37
|
-
"sample mean (secs)": "0.
|
|
112
|
+
"time taken (ms)": "460.34",
|
|
113
|
+
"sample mean (secs)": "0.46",
|
|
38
114
|
"sample deviation": "0.00"
|
|
39
115
|
},
|
|
40
116
|
{
|
|
41
117
|
"test name": "100,000 add & delete randomly",
|
|
42
|
-
"time taken (ms)": "
|
|
43
|
-
"sample mean (secs)": "0.
|
|
118
|
+
"time taken (ms)": "679.75",
|
|
119
|
+
"sample mean (secs)": "0.68",
|
|
120
|
+
"sample deviation": "0.04"
|
|
121
|
+
}
|
|
122
|
+
],
|
|
123
|
+
"testName": "red-black-tree"
|
|
124
|
+
},
|
|
125
|
+
"doubly-linked-list": {
|
|
126
|
+
"benchmarks": [
|
|
127
|
+
{
|
|
128
|
+
"test name": "1,000,000 push",
|
|
129
|
+
"time taken (ms)": "182.03",
|
|
130
|
+
"sample mean (secs)": "0.18",
|
|
131
|
+
"sample deviation": "0.02"
|
|
132
|
+
},
|
|
133
|
+
{
|
|
134
|
+
"test name": "1,000,000 unshift",
|
|
135
|
+
"time taken (ms)": "185.94",
|
|
136
|
+
"sample mean (secs)": "0.19",
|
|
137
|
+
"sample deviation": "0.03"
|
|
138
|
+
},
|
|
139
|
+
{
|
|
140
|
+
"test name": "1,000,000 unshift & shift",
|
|
141
|
+
"time taken (ms)": "159.02",
|
|
142
|
+
"sample mean (secs)": "0.16",
|
|
143
|
+
"sample deviation": "0.03"
|
|
144
|
+
},
|
|
145
|
+
{
|
|
146
|
+
"test name": "1,000,000 addBefore",
|
|
147
|
+
"time taken (ms)": "252.73",
|
|
148
|
+
"sample mean (secs)": "0.25",
|
|
149
|
+
"sample deviation": "0.03"
|
|
150
|
+
}
|
|
151
|
+
],
|
|
152
|
+
"testName": "doubly-linked-list"
|
|
153
|
+
},
|
|
154
|
+
"directed-graph": {
|
|
155
|
+
"benchmarks": [
|
|
156
|
+
{
|
|
157
|
+
"test name": "1,000 addVertex",
|
|
158
|
+
"time taken (ms)": "0.10",
|
|
159
|
+
"sample mean (secs)": "9.56e-5",
|
|
160
|
+
"sample deviation": "9.71e-7"
|
|
161
|
+
},
|
|
162
|
+
{
|
|
163
|
+
"test name": "1,000 addEdge",
|
|
164
|
+
"time taken (ms)": "5.97",
|
|
165
|
+
"sample mean (secs)": "0.01",
|
|
166
|
+
"sample deviation": "1.99e-4"
|
|
167
|
+
},
|
|
168
|
+
{
|
|
169
|
+
"test name": "1,000 getVertex",
|
|
170
|
+
"time taken (ms)": "0.10",
|
|
171
|
+
"sample mean (secs)": "9.71e-5",
|
|
172
|
+
"sample deviation": "1.17e-6"
|
|
173
|
+
},
|
|
174
|
+
{
|
|
175
|
+
"test name": "1,000 getEdge",
|
|
176
|
+
"time taken (ms)": "23.25",
|
|
177
|
+
"sample mean (secs)": "0.02",
|
|
178
|
+
"sample deviation": "0.00"
|
|
179
|
+
},
|
|
180
|
+
{
|
|
181
|
+
"test name": "tarjan",
|
|
182
|
+
"time taken (ms)": "192.40",
|
|
183
|
+
"sample mean (secs)": "0.19",
|
|
184
|
+
"sample deviation": "0.00"
|
|
185
|
+
},
|
|
186
|
+
{
|
|
187
|
+
"test name": "topologicalSort",
|
|
188
|
+
"time taken (ms)": "151.03",
|
|
189
|
+
"sample mean (secs)": "0.15",
|
|
190
|
+
"sample deviation": "0.01"
|
|
191
|
+
}
|
|
192
|
+
],
|
|
193
|
+
"testName": "directed-graph"
|
|
194
|
+
},
|
|
195
|
+
"queue": {
|
|
196
|
+
"benchmarks": [
|
|
197
|
+
{
|
|
198
|
+
"test name": "1,000,000 push",
|
|
199
|
+
"time taken (ms)": "53.79",
|
|
200
|
+
"sample mean (secs)": "0.05",
|
|
201
|
+
"sample deviation": "0.02"
|
|
202
|
+
},
|
|
203
|
+
{
|
|
204
|
+
"test name": "100,000 push & shift",
|
|
205
|
+
"time taken (ms)": "5.49",
|
|
206
|
+
"sample mean (secs)": "0.01",
|
|
44
207
|
"sample deviation": "0.00"
|
|
208
|
+
},
|
|
209
|
+
{
|
|
210
|
+
"test name": "Native JS Array 100,000 push & shift",
|
|
211
|
+
"time taken (ms)": "2358.01",
|
|
212
|
+
"sample mean (secs)": "2.36",
|
|
213
|
+
"sample deviation": "0.32"
|
|
45
214
|
}
|
|
46
215
|
],
|
|
47
|
-
"testName": "
|
|
216
|
+
"testName": "queue"
|
|
217
|
+
},
|
|
218
|
+
"deque": {
|
|
219
|
+
"benchmarks": [
|
|
220
|
+
{
|
|
221
|
+
"test name": "1,000,000 push",
|
|
222
|
+
"time taken (ms)": "23.74",
|
|
223
|
+
"sample mean (secs)": "0.02",
|
|
224
|
+
"sample deviation": "0.01"
|
|
225
|
+
},
|
|
226
|
+
{
|
|
227
|
+
"test name": "1,000,000 push & pop",
|
|
228
|
+
"time taken (ms)": "25.37",
|
|
229
|
+
"sample mean (secs)": "0.03",
|
|
230
|
+
"sample deviation": "0.01"
|
|
231
|
+
},
|
|
232
|
+
{
|
|
233
|
+
"test name": "1,000,000 push & shift",
|
|
234
|
+
"time taken (ms)": "27.61",
|
|
235
|
+
"sample mean (secs)": "0.03",
|
|
236
|
+
"sample deviation": "0.01"
|
|
237
|
+
},
|
|
238
|
+
{
|
|
239
|
+
"test name": "100,000 push & shift",
|
|
240
|
+
"time taken (ms)": "2.77",
|
|
241
|
+
"sample mean (secs)": "0.00",
|
|
242
|
+
"sample deviation": "0.00"
|
|
243
|
+
},
|
|
244
|
+
{
|
|
245
|
+
"test name": "Native JS Array 100,000 push & shift",
|
|
246
|
+
"time taken (ms)": "2430.40",
|
|
247
|
+
"sample mean (secs)": "2.43",
|
|
248
|
+
"sample deviation": "0.31"
|
|
249
|
+
},
|
|
250
|
+
{
|
|
251
|
+
"test name": "100,000 unshift & shift",
|
|
252
|
+
"time taken (ms)": "2.46",
|
|
253
|
+
"sample mean (secs)": "0.00",
|
|
254
|
+
"sample deviation": "8.81e-4"
|
|
255
|
+
},
|
|
256
|
+
{
|
|
257
|
+
"test name": "Native JS Array 100,000 unshift & shift",
|
|
258
|
+
"time taken (ms)": "4239.82",
|
|
259
|
+
"sample mean (secs)": "4.24",
|
|
260
|
+
"sample deviation": "0.37"
|
|
261
|
+
}
|
|
262
|
+
],
|
|
263
|
+
"testName": "deque"
|
|
264
|
+
},
|
|
265
|
+
"hash-map": {
|
|
266
|
+
"benchmarks": [
|
|
267
|
+
{
|
|
268
|
+
"test name": "1,000,000 set",
|
|
269
|
+
"time taken (ms)": "96.79",
|
|
270
|
+
"sample mean (secs)": "0.10",
|
|
271
|
+
"sample deviation": "0.05"
|
|
272
|
+
},
|
|
273
|
+
{
|
|
274
|
+
"test name": "Native JS Map 1,000,000 set",
|
|
275
|
+
"time taken (ms)": "230.38",
|
|
276
|
+
"sample mean (secs)": "0.23",
|
|
277
|
+
"sample deviation": "0.05"
|
|
278
|
+
},
|
|
279
|
+
{
|
|
280
|
+
"test name": "Native JS Set 1,000,000 add",
|
|
281
|
+
"time taken (ms)": "170.58",
|
|
282
|
+
"sample mean (secs)": "0.17",
|
|
283
|
+
"sample deviation": "0.01"
|
|
284
|
+
},
|
|
285
|
+
{
|
|
286
|
+
"test name": "1,000,000 set & get",
|
|
287
|
+
"time taken (ms)": "82.62",
|
|
288
|
+
"sample mean (secs)": "0.08",
|
|
289
|
+
"sample deviation": "0.03"
|
|
290
|
+
},
|
|
291
|
+
{
|
|
292
|
+
"test name": "Native JS Map 1,000,000 set & get",
|
|
293
|
+
"time taken (ms)": "278.89",
|
|
294
|
+
"sample mean (secs)": "0.28",
|
|
295
|
+
"sample deviation": "0.02"
|
|
296
|
+
},
|
|
297
|
+
{
|
|
298
|
+
"test name": "Native JS Set 1,000,000 add & has",
|
|
299
|
+
"time taken (ms)": "237.93",
|
|
300
|
+
"sample mean (secs)": "0.24",
|
|
301
|
+
"sample deviation": "0.02"
|
|
302
|
+
},
|
|
303
|
+
{
|
|
304
|
+
"test name": "1,000,000 ObjKey set & get",
|
|
305
|
+
"time taken (ms)": "369.62",
|
|
306
|
+
"sample mean (secs)": "0.37",
|
|
307
|
+
"sample deviation": "0.07"
|
|
308
|
+
},
|
|
309
|
+
{
|
|
310
|
+
"test name": "Native JS Map 1,000,000 ObjKey set & get",
|
|
311
|
+
"time taken (ms)": "332.09",
|
|
312
|
+
"sample mean (secs)": "0.33",
|
|
313
|
+
"sample deviation": "0.10"
|
|
314
|
+
},
|
|
315
|
+
{
|
|
316
|
+
"test name": "Native JS Set 1,000,000 ObjKey add & has",
|
|
317
|
+
"time taken (ms)": "271.98",
|
|
318
|
+
"sample mean (secs)": "0.27",
|
|
319
|
+
"sample deviation": "0.03"
|
|
320
|
+
}
|
|
321
|
+
],
|
|
322
|
+
"testName": "hash-map"
|
|
323
|
+
},
|
|
324
|
+
"trie": {
|
|
325
|
+
"benchmarks": [
|
|
326
|
+
{
|
|
327
|
+
"test name": "100,000 push",
|
|
328
|
+
"time taken (ms)": "42.65",
|
|
329
|
+
"sample mean (secs)": "0.04",
|
|
330
|
+
"sample deviation": "8.66e-4"
|
|
331
|
+
},
|
|
332
|
+
{
|
|
333
|
+
"test name": "100,000 getWords",
|
|
334
|
+
"time taken (ms)": "83.37",
|
|
335
|
+
"sample mean (secs)": "0.08",
|
|
336
|
+
"sample deviation": "0.00"
|
|
337
|
+
}
|
|
338
|
+
],
|
|
339
|
+
"testName": "trie"
|
|
340
|
+
},
|
|
341
|
+
"stack": {
|
|
342
|
+
"benchmarks": [
|
|
343
|
+
{
|
|
344
|
+
"test name": "1,000,000 push",
|
|
345
|
+
"time taken (ms)": "41.84",
|
|
346
|
+
"sample mean (secs)": "0.04",
|
|
347
|
+
"sample deviation": "0.01"
|
|
348
|
+
},
|
|
349
|
+
{
|
|
350
|
+
"test name": "1,000,000 push & pop",
|
|
351
|
+
"time taken (ms)": "46.56",
|
|
352
|
+
"sample mean (secs)": "0.05",
|
|
353
|
+
"sample deviation": "0.01"
|
|
354
|
+
}
|
|
355
|
+
],
|
|
356
|
+
"testName": "stack"
|
|
48
357
|
}
|
|
49
358
|
}
|
|
@@ -1,20 +1,12 @@
|
|
|
1
1
|
import { ElementCallback, IterableElementBaseOptions, ReduceElementCallback } from '../../types';
|
|
2
|
-
export declare abstract class IterableElementBase<E, R
|
|
2
|
+
export declare abstract class IterableElementBase<E, R> {
|
|
3
3
|
/**
|
|
4
4
|
* The protected constructor initializes the options for the IterableElementBase class, including the
|
|
5
5
|
* toElementFn function.
|
|
6
6
|
* @param [options] - An optional object that contains the following properties:
|
|
7
7
|
*/
|
|
8
8
|
protected constructor(options?: IterableElementBaseOptions<E, R>);
|
|
9
|
-
abstract get size(): number;
|
|
10
9
|
protected _toElementFn?: (rawElement: R) => E;
|
|
11
|
-
/**
|
|
12
|
-
* The function returns the _toElementFn property, which is a function that converts a raw element to
|
|
13
|
-
* a specific type.
|
|
14
|
-
* @returns The function `get toElementFn()` is returning either a function that takes a raw element
|
|
15
|
-
* `rawElement` of type `R` and returns an element `E`, or `undefined` if no function is assigned to
|
|
16
|
-
* `_toElementFn`.
|
|
17
|
-
*/
|
|
18
10
|
get toElementFn(): ((rawElement: R) => E) | undefined;
|
|
19
11
|
/**
|
|
20
12
|
* Time Complexity: O(n)
|
|
@@ -47,7 +39,7 @@ export declare abstract class IterableElementBase<E, R, C> {
|
|
|
47
39
|
* @returns The `every` method is returning a boolean value. It returns `true` if every element in
|
|
48
40
|
* the array satisfies the provided predicate function, and `false` otherwise.
|
|
49
41
|
*/
|
|
50
|
-
every(predicate: ElementCallback<E, R, boolean
|
|
42
|
+
every(predicate: ElementCallback<E, R, boolean>, thisArg?: any): boolean;
|
|
51
43
|
/**
|
|
52
44
|
* Time Complexity: O(n)
|
|
53
45
|
* Space Complexity: O(1)
|
|
@@ -62,7 +54,7 @@ export declare abstract class IterableElementBase<E, R, C> {
|
|
|
62
54
|
* @returns a boolean value. It returns true if the predicate function returns true for any element
|
|
63
55
|
* in the collection, and false otherwise.
|
|
64
56
|
*/
|
|
65
|
-
some(predicate: ElementCallback<E, R, boolean
|
|
57
|
+
some(predicate: ElementCallback<E, R, boolean>, thisArg?: any): boolean;
|
|
66
58
|
/**
|
|
67
59
|
* Time Complexity: O(n)
|
|
68
60
|
* Space Complexity: O(1)
|
|
@@ -76,24 +68,9 @@ export declare abstract class IterableElementBase<E, R, C> {
|
|
|
76
68
|
* to be used as `this` when executing the `callbackfn` function. If `thisArg` is provided, it will
|
|
77
69
|
* be passed as the `this` value to the `callbackfn` function. If `thisArg
|
|
78
70
|
*/
|
|
79
|
-
forEach(callbackfn: ElementCallback<E, R, void
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
* Space Complexity: O(1)
|
|
83
|
-
*
|
|
84
|
-
* The `find` function iterates over the elements of an array-like object and returns the first
|
|
85
|
-
* element that satisfies the provided callback function.
|
|
86
|
-
* @param callbackfn - The callbackfn parameter is a function that will be called for each element in
|
|
87
|
-
* the array. It takes three arguments: the current element being processed, the index of the current
|
|
88
|
-
* element, and the array itself. The function should return a boolean value indicating whether the
|
|
89
|
-
* current element matches the desired condition.
|
|
90
|
-
* @param {any} [thisArg] - The `thisArg` parameter is an optional argument that specifies the value
|
|
91
|
-
* to be used as `this` when executing the `callbackfn` function. If `thisArg` is provided, it will
|
|
92
|
-
* be passed as the `this` value to the `callbackfn` function. If `thisArg
|
|
93
|
-
* @returns The `find` method returns the first element in the array that satisfies the provided
|
|
94
|
-
* callback function. If no element satisfies the callback function, `undefined` is returned.
|
|
95
|
-
*/
|
|
96
|
-
find(callbackfn: ElementCallback<E, R, boolean, C>, thisArg?: any): E | undefined;
|
|
71
|
+
forEach(callbackfn: ElementCallback<E, R, void>, thisArg?: any): void;
|
|
72
|
+
find<S extends E>(predicate: ElementCallback<E, R, S>, thisArg?: any): S | undefined;
|
|
73
|
+
find(predicate: ElementCallback<E, R, unknown>, thisArg?: any): E | undefined;
|
|
97
74
|
/**
|
|
98
75
|
* Time Complexity: O(n)
|
|
99
76
|
* Space Complexity: O(1)
|
|
@@ -105,20 +82,17 @@ export declare abstract class IterableElementBase<E, R, C> {
|
|
|
105
82
|
* otherwise.
|
|
106
83
|
*/
|
|
107
84
|
has(element: E): boolean;
|
|
85
|
+
reduce(callbackfn: ReduceElementCallback<E, R>): E;
|
|
86
|
+
reduce(callbackfn: ReduceElementCallback<E, R>, initialValue: E): E;
|
|
87
|
+
reduce<U>(callbackfn: ReduceElementCallback<E, R, U>, initialValue: U): U;
|
|
108
88
|
/**
|
|
109
89
|
* Time Complexity: O(n)
|
|
110
|
-
* Space Complexity: O(
|
|
90
|
+
* Space Complexity: O(n)
|
|
111
91
|
*
|
|
112
|
-
* The `
|
|
113
|
-
*
|
|
114
|
-
* @param callbackfn - The callbackfn parameter is a function that will be called for each element in
|
|
115
|
-
* the array. It takes four arguments:
|
|
116
|
-
* @param {U} initialValue - The initialValue parameter is the initial value of the accumulator. It
|
|
117
|
-
* is the value that the accumulator starts with before the reduction operation begins.
|
|
118
|
-
* @returns The `reduce` method is returning the final value of the accumulator after iterating over
|
|
119
|
-
* all the elements in the array and applying the callback function to each element.
|
|
92
|
+
* The `toArray` function converts a linked list into an array.
|
|
93
|
+
* @returns The `toArray()` method is returning an array of type `E[]`.
|
|
120
94
|
*/
|
|
121
|
-
|
|
95
|
+
toArray(): E[];
|
|
122
96
|
/**
|
|
123
97
|
* Time Complexity: O(n)
|
|
124
98
|
* Space Complexity: O(n)
|
|
@@ -135,7 +109,7 @@ export declare abstract class IterableElementBase<E, R, C> {
|
|
|
135
109
|
print(): void;
|
|
136
110
|
abstract isEmpty(): boolean;
|
|
137
111
|
abstract clear(): void;
|
|
138
|
-
abstract clone():
|
|
112
|
+
abstract clone(): IterableElementBase<E, R>;
|
|
139
113
|
abstract map(...args: any[]): any;
|
|
140
114
|
abstract filter(...args: any[]): any;
|
|
141
115
|
protected abstract _getIterator(...args: any[]): IterableIterator<E>;
|