data-structure-typed 1.44.0 → 1.45.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.
Files changed (57) hide show
  1. package/CHANGELOG.md +1 -1
  2. package/README.md +15 -15
  3. package/benchmark/report.html +30 -30
  4. package/benchmark/report.json +144 -198
  5. package/dist/cjs/data-structures/hash/hash-map.d.ts +230 -37
  6. package/dist/cjs/data-structures/hash/hash-map.js +430 -118
  7. package/dist/cjs/data-structures/hash/hash-map.js.map +1 -1
  8. package/dist/cjs/types/data-structures/graph/directed-graph.d.ts +0 -5
  9. package/dist/cjs/types/data-structures/graph/directed-graph.js +0 -7
  10. package/dist/cjs/types/data-structures/graph/directed-graph.js.map +1 -1
  11. package/dist/cjs/types/data-structures/hash/hash-map.d.ts +15 -1
  12. package/dist/cjs/types/data-structures/hash/index.d.ts +6 -0
  13. package/dist/cjs/types/data-structures/hash/index.js +20 -0
  14. package/dist/cjs/types/data-structures/hash/index.js.map +1 -1
  15. package/dist/cjs/utils/utils.d.ts +3 -0
  16. package/dist/cjs/utils/utils.js +15 -1
  17. package/dist/cjs/utils/utils.js.map +1 -1
  18. package/dist/mjs/data-structures/hash/hash-map.d.ts +230 -37
  19. package/dist/mjs/data-structures/hash/hash-map.js +435 -123
  20. package/dist/mjs/types/data-structures/graph/directed-graph.d.ts +0 -5
  21. package/dist/mjs/types/data-structures/graph/directed-graph.js +1 -6
  22. package/dist/mjs/types/data-structures/hash/hash-map.d.ts +15 -1
  23. package/dist/mjs/types/data-structures/hash/index.d.ts +6 -0
  24. package/dist/mjs/types/data-structures/hash/index.js +6 -1
  25. package/dist/mjs/utils/utils.d.ts +3 -0
  26. package/dist/mjs/utils/utils.js +11 -0
  27. package/dist/umd/data-structure-typed.js +532 -217
  28. package/dist/umd/data-structure-typed.min.js +1 -1
  29. package/dist/umd/data-structure-typed.min.js.map +1 -1
  30. package/package.json +9 -7
  31. package/src/data-structures/hash/hash-map.ts +432 -125
  32. package/src/types/data-structures/graph/directed-graph.ts +0 -6
  33. package/src/types/data-structures/hash/hash-map.ts +17 -1
  34. package/src/types/data-structures/hash/index.ts +7 -0
  35. package/src/utils/utils.ts +13 -0
  36. package/test/integration/all-in-one.ts +110 -0
  37. package/test/performance/reportor.ts +2 -2
  38. package/test/unit/data-structures/binary-tree/avl-tree.test.ts +2 -2
  39. package/test/unit/data-structures/binary-tree/bst.test.ts +6 -6
  40. package/test/unit/data-structures/binary-tree/overall.test.ts +1 -1
  41. package/test/unit/data-structures/binary-tree/rb-tree.test.ts +14 -14
  42. package/test/unit/data-structures/binary-tree/tree-multimap.test.ts +2 -2
  43. package/test/unit/data-structures/graph/abstract-graph.test.ts +2 -1
  44. package/test/unit/data-structures/graph/undirected-graph.test.ts +1 -1
  45. package/test/unit/data-structures/hash/hash-map.test.ts +151 -20
  46. package/test/unit/data-structures/heap/heap.test.ts +8 -8
  47. package/test/unit/data-structures/heap/max-heap.test.ts +4 -4
  48. package/test/unit/data-structures/heap/min-heap.test.ts +4 -4
  49. package/test/unit/data-structures/linked-list/doubly-linked-list.test.ts +1 -1
  50. package/test/unit/data-structures/linked-list/singly-linked-list.test.ts +2 -2
  51. package/test/unit/data-structures/linked-list/skip-list.test.ts +4 -4
  52. package/test/unit/data-structures/priority-queue/max-priority-queue.test.ts +2 -2
  53. package/test/unit/data-structures/priority-queue/priority-queue.test.ts +8 -2
  54. package/test/unit/data-structures/queue/deque.test.ts +25 -25
  55. package/test/unit/data-structures/trie/trie.test.ts +9 -9
  56. package/test/utils/array.ts +1 -1
  57. package/test/utils/number.ts +1 -1
@@ -1,395 +1,341 @@
1
1
  {
2
- "avl-tree.test.js": {
2
+ "avl-tree": {
3
3
  "benchmarks": [
4
4
  {
5
5
  "test name": "10,000 add randomly",
6
- "time taken (ms)": "31.35",
7
- "executions per sec": "31.90",
8
- "sample deviation": "6.69e-4"
6
+ "time taken (ms)": "33.34",
7
+ "executions per sec": "29.99",
8
+ "sample deviation": "0.00"
9
9
  },
10
10
  {
11
11
  "test name": "10,000 add & delete randomly",
12
- "time taken (ms)": "70.29",
13
- "executions per sec": "14.23",
12
+ "time taken (ms)": "72.30",
13
+ "executions per sec": "13.83",
14
14
  "sample deviation": "0.00"
15
15
  },
16
16
  {
17
17
  "test name": "10,000 addMany",
18
- "time taken (ms)": "40.95",
19
- "executions per sec": "24.42",
18
+ "time taken (ms)": "49.50",
19
+ "executions per sec": "20.20",
20
20
  "sample deviation": "0.00"
21
21
  },
22
22
  {
23
23
  "test name": "10,000 get",
24
- "time taken (ms)": "27.36",
25
- "executions per sec": "36.55",
26
- "sample deviation": "3.94e-4"
24
+ "time taken (ms)": "27.23",
25
+ "executions per sec": "36.73",
26
+ "sample deviation": "7.19e-4"
27
27
  }
28
28
  ],
29
- "testName": "avl-tree.test.js"
29
+ "testName": "avl-tree"
30
30
  },
31
- "binary-tree.test.js": {
31
+ "binary-tree": {
32
32
  "benchmarks": [
33
33
  {
34
34
  "test name": "1,000 add randomly",
35
- "time taken (ms)": "12.12",
36
- "executions per sec": "82.53",
37
- "sample deviation": "1.47e-4"
35
+ "time taken (ms)": "12.20",
36
+ "executions per sec": "81.97",
37
+ "sample deviation": "8.36e-5"
38
38
  },
39
39
  {
40
40
  "test name": "1,000 add & delete randomly",
41
- "time taken (ms)": "15.54",
42
- "executions per sec": "64.34",
43
- "sample deviation": "2.16e-4"
41
+ "time taken (ms)": "15.93",
42
+ "executions per sec": "62.77",
43
+ "sample deviation": "2.09e-4"
44
44
  },
45
45
  {
46
46
  "test name": "1,000 addMany",
47
- "time taken (ms)": "10.15",
48
- "executions per sec": "98.55",
49
- "sample deviation": "2.30e-4"
47
+ "time taken (ms)": "10.36",
48
+ "executions per sec": "96.56",
49
+ "sample deviation": "2.01e-4"
50
50
  },
51
51
  {
52
52
  "test name": "1,000 get",
53
- "time taken (ms)": "17.87",
54
- "executions per sec": "55.95",
55
- "sample deviation": "1.46e-4"
53
+ "time taken (ms)": "18.43",
54
+ "executions per sec": "54.26",
55
+ "sample deviation": "4.67e-4"
56
56
  },
57
57
  {
58
58
  "test name": "1,000 dfs",
59
- "time taken (ms)": "154.81",
60
- "executions per sec": "6.46",
59
+ "time taken (ms)": "154.61",
60
+ "executions per sec": "6.47",
61
61
  "sample deviation": "0.00"
62
62
  },
63
63
  {
64
64
  "test name": "1,000 bfs",
65
- "time taken (ms)": "55.20",
66
- "executions per sec": "18.11",
67
- "sample deviation": "1.82e-4"
65
+ "time taken (ms)": "57.73",
66
+ "executions per sec": "17.32",
67
+ "sample deviation": "0.01"
68
68
  },
69
69
  {
70
70
  "test name": "1,000 morris",
71
- "time taken (ms)": "260.41",
72
- "executions per sec": "3.84",
73
- "sample deviation": "5.23e-4"
71
+ "time taken (ms)": "258.47",
72
+ "executions per sec": "3.87",
73
+ "sample deviation": "0.00"
74
74
  }
75
75
  ],
76
- "testName": "binary-tree.test.js"
76
+ "testName": "binary-tree"
77
77
  },
78
- "bst.test.js": {
78
+ "bst": {
79
79
  "benchmarks": [
80
80
  {
81
81
  "test name": "10,000 add randomly",
82
- "time taken (ms)": "30.32",
83
- "executions per sec": "32.98",
84
- "sample deviation": "2.49e-4"
82
+ "time taken (ms)": "29.44",
83
+ "executions per sec": "33.96",
84
+ "sample deviation": "3.99e-4"
85
85
  },
86
86
  {
87
87
  "test name": "10,000 add & delete randomly",
88
- "time taken (ms)": "71.51",
89
- "executions per sec": "13.98",
88
+ "time taken (ms)": "72.35",
89
+ "executions per sec": "13.82",
90
90
  "sample deviation": "0.00"
91
91
  },
92
92
  {
93
93
  "test name": "10,000 addMany",
94
- "time taken (ms)": "28.90",
95
- "executions per sec": "34.60",
94
+ "time taken (ms)": "29.76",
95
+ "executions per sec": "33.60",
96
96
  "sample deviation": "0.00"
97
97
  },
98
98
  {
99
99
  "test name": "10,000 get",
100
- "time taken (ms)": "27.75",
101
- "executions per sec": "36.04",
102
- "sample deviation": "6.92e-4"
100
+ "time taken (ms)": "28.53",
101
+ "executions per sec": "35.05",
102
+ "sample deviation": "5.76e-4"
103
103
  }
104
104
  ],
105
- "testName": "bst.test.js"
105
+ "testName": "bst"
106
106
  },
107
- "rb-tree.test.js": {
107
+ "rb-tree": {
108
108
  "benchmarks": [
109
109
  {
110
110
  "test name": "100,000 add",
111
- "time taken (ms)": "86.45",
112
- "executions per sec": "11.57",
113
- "sample deviation": "0.00"
114
- },
115
- {
116
- "test name": "100,000 competitor add",
117
- "time taken (ms)": "46.78",
118
- "executions per sec": "21.38",
119
- "sample deviation": "0.00"
111
+ "time taken (ms)": "90.42",
112
+ "executions per sec": "11.06",
113
+ "sample deviation": "0.01"
120
114
  },
121
115
  {
122
116
  "test name": "100,000 add & delete randomly",
123
- "time taken (ms)": "219.22",
124
- "executions per sec": "4.56",
125
- "sample deviation": "0.01"
117
+ "time taken (ms)": "223.52",
118
+ "executions per sec": "4.47",
119
+ "sample deviation": "0.02"
126
120
  },
127
121
  {
128
122
  "test name": "100,000 getNode",
129
- "time taken (ms)": "37.83",
130
- "executions per sec": "26.43",
131
- "sample deviation": "6.20e-4"
123
+ "time taken (ms)": "38.67",
124
+ "executions per sec": "25.86",
125
+ "sample deviation": "0.00"
132
126
  }
133
127
  ],
134
- "testName": "rb-tree.test.js"
128
+ "testName": "rb-tree"
135
129
  },
136
- "directed-graph.test.js": {
130
+ "directed-graph": {
137
131
  "benchmarks": [
138
132
  {
139
133
  "test name": "1,000 addVertex",
140
134
  "time taken (ms)": "0.11",
141
- "executions per sec": "9232.27",
142
- "sample deviation": "3.15e-5"
135
+ "executions per sec": "9499.56",
136
+ "sample deviation": "5.09e-6"
143
137
  },
144
138
  {
145
139
  "test name": "1,000 addEdge",
146
- "time taken (ms)": "6.54",
147
- "executions per sec": "152.80",
148
- "sample deviation": "8.60e-4"
140
+ "time taken (ms)": "6.37",
141
+ "executions per sec": "157.04",
142
+ "sample deviation": "8.13e-4"
149
143
  },
150
144
  {
151
145
  "test name": "1,000 getVertex",
152
146
  "time taken (ms)": "0.05",
153
- "executions per sec": "2.16e+4",
154
- "sample deviation": "3.45e-7"
147
+ "executions per sec": "2.15e+4",
148
+ "sample deviation": "1.20e-6"
155
149
  },
156
150
  {
157
151
  "test name": "1,000 getEdge",
158
- "time taken (ms)": "22.17",
159
- "executions per sec": "45.10",
152
+ "time taken (ms)": "22.44",
153
+ "executions per sec": "44.56",
160
154
  "sample deviation": "0.00"
161
155
  },
162
156
  {
163
157
  "test name": "tarjan",
164
- "time taken (ms)": "211.64",
165
- "executions per sec": "4.72",
158
+ "time taken (ms)": "213.53",
159
+ "executions per sec": "4.68",
166
160
  "sample deviation": "0.01"
167
161
  },
168
162
  {
169
163
  "test name": "tarjan all",
170
- "time taken (ms)": "209.87",
171
- "executions per sec": "4.76",
164
+ "time taken (ms)": "215.75",
165
+ "executions per sec": "4.63",
172
166
  "sample deviation": "0.00"
173
167
  },
174
168
  {
175
169
  "test name": "topologicalSort",
176
- "time taken (ms)": "170.27",
177
- "executions per sec": "5.87",
178
- "sample deviation": "0.00"
170
+ "time taken (ms)": "175.51",
171
+ "executions per sec": "5.70",
172
+ "sample deviation": "0.01"
179
173
  }
180
174
  ],
181
- "testName": "directed-graph.test.js"
175
+ "testName": "directed-graph"
182
176
  },
183
- "hash-map.test.js": {
177
+ "hash-map": {
184
178
  "benchmarks": [
185
179
  {
186
180
  "test name": "10,000 set",
187
- "time taken (ms)": "16.01",
188
- "executions per sec": "62.47",
189
- "sample deviation": "0.00"
190
- },
191
- {
192
- "test name": "10,000 competitor set",
193
- "time taken (ms)": "0.57",
194
- "executions per sec": "1748.11",
195
- "sample deviation": "1.49e-5"
181
+ "time taken (ms)": "0.76",
182
+ "executions per sec": "1308.63",
183
+ "sample deviation": "1.65e-5"
196
184
  },
197
185
  {
198
186
  "test name": "10,000 set & get",
199
- "time taken (ms)": "34.39",
200
- "executions per sec": "29.08",
201
- "sample deviation": "4.42e-4"
202
- },
203
- {
204
- "test name": "10,000 competitor set & get",
205
- "time taken (ms)": "0.67",
206
- "executions per sec": "1488.07",
207
- "sample deviation": "3.39e-5"
187
+ "time taken (ms)": "1.03",
188
+ "executions per sec": "966.59",
189
+ "sample deviation": "2.21e-5"
208
190
  }
209
191
  ],
210
- "testName": "hash-map.test.js"
192
+ "testName": "hash-map"
211
193
  },
212
- "heap.test.js": {
194
+ "heap": {
213
195
  "benchmarks": [
214
196
  {
215
197
  "test name": "10,000 add & pop",
216
- "time taken (ms)": "4.67",
217
- "executions per sec": "213.95",
218
- "sample deviation": "2.17e-4"
198
+ "time taken (ms)": "4.65",
199
+ "executions per sec": "214.92",
200
+ "sample deviation": "1.18e-4"
219
201
  },
220
202
  {
221
203
  "test name": "10,000 fib add & pop",
222
- "time taken (ms)": "352.78",
223
- "executions per sec": "2.83",
204
+ "time taken (ms)": "367.35",
205
+ "executions per sec": "2.72",
224
206
  "sample deviation": "0.01"
225
207
  }
226
208
  ],
227
- "testName": "heap.test.js"
209
+ "testName": "heap"
228
210
  },
229
- "doubly-linked-list.test.js": {
211
+ "doubly-linked-list": {
230
212
  "benchmarks": [
231
213
  {
232
214
  "test name": "1,000,000 unshift",
233
- "time taken (ms)": "230.25",
234
- "executions per sec": "4.34",
235
- "sample deviation": "0.03"
236
- },
237
- {
238
- "test name": "1,000,000 competitor unshift",
239
- "time taken (ms)": "82.22",
240
- "executions per sec": "12.16",
241
- "sample deviation": "0.02"
215
+ "time taken (ms)": "222.80",
216
+ "executions per sec": "4.49",
217
+ "sample deviation": "0.06"
242
218
  },
243
219
  {
244
220
  "test name": "1,000,000 unshift & shift",
245
- "time taken (ms)": "166.38",
246
- "executions per sec": "6.01",
247
- "sample deviation": "0.02"
221
+ "time taken (ms)": "174.60",
222
+ "executions per sec": "5.73",
223
+ "sample deviation": "0.04"
248
224
  },
249
225
  {
250
226
  "test name": "1,000,000 insertBefore",
251
- "time taken (ms)": "319.13",
252
- "executions per sec": "3.13",
227
+ "time taken (ms)": "309.21",
228
+ "executions per sec": "3.23",
253
229
  "sample deviation": "0.07"
254
230
  }
255
231
  ],
256
- "testName": "doubly-linked-list.test.js"
232
+ "testName": "doubly-linked-list"
257
233
  },
258
- "singly-linked-list.test.js": {
234
+ "singly-linked-list": {
259
235
  "benchmarks": [
260
236
  {
261
237
  "test name": "10,000 push & pop",
262
- "time taken (ms)": "222.94",
263
- "executions per sec": "4.49",
264
- "sample deviation": "0.02"
238
+ "time taken (ms)": "214.75",
239
+ "executions per sec": "4.66",
240
+ "sample deviation": "0.01"
265
241
  },
266
242
  {
267
243
  "test name": "10,000 insertBefore",
268
- "time taken (ms)": "249.12",
269
- "executions per sec": "4.01",
244
+ "time taken (ms)": "250.45",
245
+ "executions per sec": "3.99",
270
246
  "sample deviation": "0.01"
271
247
  }
272
248
  ],
273
- "testName": "singly-linked-list.test.js"
249
+ "testName": "singly-linked-list"
274
250
  },
275
- "max-priority-queue.test.js": {
251
+ "max-priority-queue": {
276
252
  "benchmarks": [
277
253
  {
278
254
  "test name": "10,000 refill & poll",
279
- "time taken (ms)": "11.37",
280
- "executions per sec": "87.97",
281
- "sample deviation": "1.21e-4"
255
+ "time taken (ms)": "11.44",
256
+ "executions per sec": "87.43",
257
+ "sample deviation": "1.80e-4"
282
258
  }
283
259
  ],
284
- "testName": "max-priority-queue.test.js"
260
+ "testName": "max-priority-queue"
285
261
  },
286
- "priority-queue.test.js": {
262
+ "priority-queue": {
287
263
  "benchmarks": [
288
264
  {
289
265
  "test name": "10,000 add & pop",
290
- "time taken (ms)": "12.37",
291
- "executions per sec": "80.85",
292
- "sample deviation": "6.48e-5"
293
- },
294
- {
295
- "test name": "10,000 competitor add & pop",
296
- "time taken (ms)": "2.13",
297
- "executions per sec": "468.67",
298
- "sample deviation": "6.91e-5"
266
+ "time taken (ms)": "12.41",
267
+ "executions per sec": "80.57",
268
+ "sample deviation": "1.56e-4"
299
269
  }
300
270
  ],
301
- "testName": "priority-queue.test.js"
271
+ "testName": "priority-queue"
302
272
  },
303
- "deque.test.js": {
273
+ "deque": {
304
274
  "benchmarks": [
305
275
  {
306
276
  "test name": "1,000,000 push",
307
- "time taken (ms)": "207.83",
308
- "executions per sec": "4.81",
309
- "sample deviation": "0.03"
310
- },
311
- {
312
- "test name": "1,000,000 competitor push",
313
- "time taken (ms)": "14.45",
314
- "executions per sec": "69.20",
315
- "sample deviation": "1.19e-4"
277
+ "time taken (ms)": "219.15",
278
+ "executions per sec": "4.56",
279
+ "sample deviation": "0.04"
316
280
  },
317
281
  {
318
282
  "test name": "1,000,000 shift",
319
- "time taken (ms)": "24.73",
320
- "executions per sec": "40.43",
283
+ "time taken (ms)": "26.76",
284
+ "executions per sec": "37.37",
321
285
  "sample deviation": "0.00"
322
286
  }
323
287
  ],
324
- "testName": "deque.test.js"
288
+ "testName": "deque"
325
289
  },
326
- "queue.test.js": {
290
+ "queue": {
327
291
  "benchmarks": [
328
292
  {
329
293
  "test name": "1,000,000 push",
330
- "time taken (ms)": "43.17",
331
- "executions per sec": "23.16",
332
- "sample deviation": "0.01"
333
- },
334
- {
335
- "test name": "1,000,000 competitor push",
336
- "time taken (ms)": "47.17",
337
- "executions per sec": "21.20",
294
+ "time taken (ms)": "45.17",
295
+ "executions per sec": "22.14",
338
296
  "sample deviation": "0.01"
339
297
  },
340
298
  {
341
299
  "test name": "1,000,000 push & shift",
342
- "time taken (ms)": "79.55",
343
- "executions per sec": "12.57",
344
- "sample deviation": "7.42e-4"
300
+ "time taken (ms)": "80.41",
301
+ "executions per sec": "12.44",
302
+ "sample deviation": "0.00"
345
303
  }
346
304
  ],
347
- "testName": "queue.test.js"
305
+ "testName": "queue"
348
306
  },
349
- "stack.test.js": {
307
+ "stack": {
350
308
  "benchmarks": [
351
309
  {
352
310
  "test name": "1,000,000 push",
353
- "time taken (ms)": "43.39",
354
- "executions per sec": "23.05",
355
- "sample deviation": "0.01"
356
- },
357
- {
358
- "test name": "1,000,000 competitor push",
359
- "time taken (ms)": "43.04",
360
- "executions per sec": "23.23",
311
+ "time taken (ms)": "43.67",
312
+ "executions per sec": "22.90",
361
313
  "sample deviation": "0.01"
362
314
  },
363
315
  {
364
316
  "test name": "1,000,000 push & pop",
365
- "time taken (ms)": "50.18",
366
- "executions per sec": "19.93",
367
- "sample deviation": "0.01"
368
- },
369
- {
370
- "test name": "1,000,000 competitor push & pop",
371
- "time taken (ms)": "49.06",
372
- "executions per sec": "20.38",
317
+ "time taken (ms)": "48.18",
318
+ "executions per sec": "20.76",
373
319
  "sample deviation": "0.00"
374
320
  }
375
321
  ],
376
- "testName": "stack.test.js"
322
+ "testName": "stack"
377
323
  },
378
- "trie.test.js": {
324
+ "trie": {
379
325
  "benchmarks": [
380
326
  {
381
327
  "test name": "100,000 push",
382
- "time taken (ms)": "42.19",
383
- "executions per sec": "23.70",
384
- "sample deviation": "6.72e-4"
328
+ "time taken (ms)": "60.46",
329
+ "executions per sec": "16.54",
330
+ "sample deviation": "0.00"
385
331
  },
386
332
  {
387
333
  "test name": "100,000 getWords",
388
- "time taken (ms)": "95.42",
389
- "executions per sec": "10.48",
334
+ "time taken (ms)": "83.13",
335
+ "executions per sec": "12.03",
390
336
  "sample deviation": "0.00"
391
337
  }
392
338
  ],
393
- "testName": "trie.test.js"
339
+ "testName": "trie"
394
340
  }
395
341
  }