diff --git a/README.md b/README.md index 72dba58..21d912b 100644 --- a/README.md +++ b/README.md @@ -760,52 +760,52 @@ Array.from(dijkstraResult?.seen ?? []).map(vertex => vertex.key) // ['A', 'B', ' [//]: # (No deletion!!! Start of Replace Section)
comparison
-
test nametime taken (ms)executions per secsample deviation
SRC 10,000 add0.571745.585.41e-6
CJS 10,000 add0.571751.774.80e-6
MJS 10,000 add0.571749.466.15e-6
SRC PQ 10,000 add & pop3.42292.802.97e-5
CJS PQ 10,000 add & pop3.40293.713.10e-5
MJS PQ 10,000 add & pop3.41293.623.51e-5
+
test nametime taken (ms)executions per secsample deviation
SRC 10,000 add0.571745.635.99e-6
CJS 10,000 add0.571746.435.30e-6
MJS 10,000 add0.581724.975.73e-5
CPT PQ 10,000 add0.571745.617.49e-6
SRC PQ 10,000 add & pop3.42292.153.23e-5
CJS PQ 10,000 add & pop3.37296.363.64e-5
MJS PQ 10,000 add & pop3.37296.663.48e-5
CPT PQ 10,000 add & pop2.07482.942.10e-5
CPT OM 100,000 add44.4722.490.00
CPT HM 10,000 set0.581716.991.45e-5
CPT HM 10,000 set & get0.671491.781.61e-5
CPT LL 1,000,000 unshift67.9514.720.02
CPT PQ 10,000 add & pop2.09478.649.70e-5
CPT DQ 1,000,000 push14.5068.962.78e-4
CPT Q 1,000,000 push47.5121.050.00
CPT ST 1,000,000 push42.0323.790.01
CPT ST 1,000,000 push & pop48.8420.480.00
avl-tree
-
test nametime taken (ms)executions per secsample deviation
10,000 add randomly31.2532.003.13e-4
10,000 add & delete randomly71.8713.910.00
10,000 addMany41.0624.364.25e-4
10,000 get28.1035.592.51e-4
+
test nametime taken (ms)executions per secsample deviation
10,000 add randomly30.9532.324.46e-4
10,000 add & delete randomly70.8414.120.00
10,000 addMany40.6424.613.31e-4
10,000 get27.9235.812.07e-4
binary-tree
-
test nametime taken (ms)executions per secsample deviation
1,000 add randomly13.0276.791.25e-4
1,000 add & delete randomly15.8663.051.08e-4
1,000 addMany10.2697.467.97e-5
1,000 get18.3554.493.12e-4
1,000 dfs154.506.477.28e-4
1,000 bfs56.5317.693.74e-4
1,000 morris257.073.890.00
+
test nametime taken (ms)executions per secsample deviation
1,000 add randomly12.8577.803.77e-4
1,000 add & delete randomly15.7363.571.51e-4
1,000 addMany10.1598.509.02e-5
1,000 get18.2054.953.43e-4
1,000 dfs152.066.587.60e-4
1,000 bfs55.8517.913.14e-4
1,000 morris256.133.909.73e-4
bst
-
test nametime taken (ms)executions per secsample deviation
10,000 add randomly28.2535.403.07e-4
10,000 add & delete randomly67.6914.778.51e-4
10,000 addMany29.2534.190.00
10,000 get28.7734.762.55e-4
+
test nametime taken (ms)executions per secsample deviation
10,000 add randomly27.9635.762.98e-4
10,000 add & delete randomly66.9614.937.52e-4
10,000 addMany29.4233.993.30e-4
10,000 get28.5535.031.99e-4
rb-tree
-
test nametime taken (ms)executions per secsample deviation
100,000 add86.8811.510.00
100,000 add & delete randomly215.714.640.00
100,000 getNode40.7824.523.22e-4
+
test nametime taken (ms)executions per secsample deviation
100,000 add87.4211.440.00
100,000 CPT add44.1722.640.00
100,000 add & delete randomly220.914.530.02
100,000 getNode40.4824.705.58e-4
directed-graph
-
test nametime taken (ms)executions per secsample deviation
1,000 addVertex0.109992.988.63e-7
1,000 addEdge6.11163.741.31e-4
1,000 getVertex0.052.16e+46.15e-7
1,000 getEdge23.0143.450.00
tarjan222.334.500.02
tarjan all224.994.440.02
topologicalSort177.805.620.01
+
test nametime taken (ms)executions per secsample deviation
1,000 addVertex0.109667.559.48e-7
1,000 addEdge6.17161.991.79e-4
1,000 getVertex0.052.17e+43.52e-7
1,000 getEdge23.5242.510.00
tarjan220.314.540.01
tarjan all224.174.460.00
topologicalSort192.505.190.03
hash-map
-
test nametime taken (ms)executions per secsample deviation
10,000 set0.991006.452.07e-5
10,000 set & get1.49669.202.66e-5
+
test nametime taken (ms)executions per secsample deviation
1,000,000 set269.883.710.04
1,000,000 CPT set251.083.980.05
1,000,000 Map set214.034.670.02
1,000,000 Set add170.845.850.01
1,000,000 set & get404.202.470.06
1,000,000 CPT set & get279.393.580.07
1,000,000 Map set & get269.853.710.01
1,000,000 Set add & has202.464.940.12
1,000,000 ObjKey set & get891.011.120.03
1,000,000 Map ObjKey set & get316.413.160.05
1,000,000 Set ObjKey add & has277.273.610.03
heap
-
test nametime taken (ms)executions per secsample deviation
10,000 add & pop5.78172.884.96e-5
10,000 fib add & pop357.912.790.01
+
test nametime taken (ms)executions per secsample deviation
10,000 add & pop5.89169.672.36e-4
10,000 fib add & pop362.102.760.00
doubly-linked-list
-
test nametime taken (ms)executions per secsample deviation
1,000,000 push207.574.820.04
1,000,000 unshift224.174.460.10
1,000,000 unshift & shift170.275.870.04
1,000,000 insertBefore325.713.070.08
+
test nametime taken (ms)executions per secsample deviation
1,000,000 push234.964.260.07
1,000,000 CPT push83.4611.980.04
1,000,000 unshift220.584.530.03
1,000,000 CPT unshift73.2613.650.03
1,000,000 unshift & shift168.565.930.01
1,000,000 insertBefore330.813.020.04
singly-linked-list
-
test nametime taken (ms)executions per secsample deviation
10,000 push & pop223.424.480.02
10,000 insertBefore253.673.940.02
+
test nametime taken (ms)executions per secsample deviation
10,000 push & pop216.944.610.02
10,000 insertBefore248.684.020.00
max-priority-queue
-
test nametime taken (ms)executions per secsample deviation
10,000 refill & poll10.5195.160.01
+
test nametime taken (ms)executions per secsample deviation
10,000 refill & poll8.78113.941.48e-4
priority-queue
-
test nametime taken (ms)executions per secsample deviation
100,000 add & pop105.619.470.00
+
test nametime taken (ms)executions per secsample deviation
100,000 add & pop103.209.690.00
100,000 CPT add & pop27.4136.497.73e-4
deque
-
test nametime taken (ms)executions per secsample deviation
1,000,000 push14.0171.394.74e-4
1,000,000 push & pop23.1243.256.61e-4
1,000,000 push & shift25.0040.000.01
1,000,000 unshift & shift22.0445.382.90e-4
+
test nametime taken (ms)executions per secsample deviation
1,000,000 push13.9971.462.13e-4
1,000,000 CPT push13.3674.881.70e-4
1,000,000 push & pop23.4742.610.01
1,000,000 push & shift24.1941.340.00
1,000,000 unshift & shift22.1345.195.99e-4
queue
-
test nametime taken (ms)executions per secsample deviation
1,000,000 push48.2520.720.01
1,000,000 push & shift83.3811.990.00
+
test nametime taken (ms)executions per secsample deviation
1,000,000 push37.0127.029.55e-4
1,000,000 CPT push43.8122.820.01
1,000,000 push & shift81.3112.300.00
stack
-
test nametime taken (ms)executions per secsample deviation
1,000,000 push45.0222.210.01
1,000,000 push & pop58.6317.060.03
+
test nametime taken (ms)executions per secsample deviation
1,000,000 push37.8826.400.00
1,000,000 CPT push39.1725.530.00
1,000,000 push & pop46.2421.630.00
1,000,000 CPT push & pop47.1621.210.00
trie
-
test nametime taken (ms)executions per secsample deviation
100,000 push44.8222.310.00
100,000 getWords111.828.940.05
+
test nametime taken (ms)executions per secsample deviation
100,000 push42.8423.358.44e-4
100,000 getWords92.2610.840.01
[//]: # (No deletion!!! End of Replace Section) diff --git a/test/integration/index.html b/test/integration/index.html index 77a0bf0..8e75a23 100644 --- a/test/integration/index.html +++ b/test/integration/index.html @@ -4,6 +4,7 @@ CDN Test + diff --git a/test/performance/data-structures/comparison.test.ts b/test/performance/data-structures/comparison/comparison.test.ts similarity index 70% rename from test/performance/data-structures/comparison.test.ts rename to test/performance/data-structures/comparison/comparison.test.ts index ae7ff99..701881b 100644 --- a/test/performance/data-structures/comparison.test.ts +++ b/test/performance/data-structures/comparison/comparison.test.ts @@ -20,19 +20,22 @@ const { TEN_THOUSAND, HUNDRED_THOUSAND, LINEAR } = magnitude; const cOrderedMap = new OrderedMap(); const arrHundredThousand = getRandomIntArray(HUNDRED_THOUSAND, 0, HUNDRED_THOUSAND, true); -suite.add(`SRC ${TEN_THOUSAND.toLocaleString()} add`, () => { +suite + .add(`SRC PQ ${TEN_THOUSAND.toLocaleString()} add`, () => { - const pq = new SRCPriorityQueue({ comparator: (a, b) => b - a }); - for (let i = 0; i < TEN_THOUSAND; i++) pq.add(i); -}).add(`CJS ${TEN_THOUSAND.toLocaleString()} add`, () => { + const pq = new SRCPriorityQueue({ comparator: (a, b) => b - a }); + for (let i = 0; i < TEN_THOUSAND; i++) pq.add(i); + }) + .add(`CJS PQ ${TEN_THOUSAND.toLocaleString()} add`, () => { - const pq = new CJSPriorityQueue({ comparator: (a, b) => b - a }); - for (let i = 0; i < TEN_THOUSAND; i++) pq.add(i); -}).add(`MJS ${TEN_THOUSAND.toLocaleString()} add`, () => { + const pq = new CJSPriorityQueue({ comparator: (a, b) => b - a }); + for (let i = 0; i < TEN_THOUSAND; i++) pq.add(i); + }) + .add(`MJS PQ ${TEN_THOUSAND.toLocaleString()} add`, () => { - const pq = new MJSPriorityQueue({ comparator: (a, b) => b - a }); - for (let i = 0; i < TEN_THOUSAND; i++) pq.add(i); -}); + const pq = new MJSPriorityQueue({ comparator: (a, b) => b - a }); + for (let i = 0; i < TEN_THOUSAND; i++) pq.add(i); + }); if (isCompetitor) { suite.add(`CPT PQ ${TEN_THOUSAND.toLocaleString()} add`, () => { @@ -42,22 +45,25 @@ if (isCompetitor) { }); } -suite.add(`SRC PQ ${TEN_THOUSAND.toLocaleString()} add & pop`, () => { - const pq = new SRCPriorityQueue({ comparator: (a, b) => b - a }); +suite + .add(`SRC PQ ${TEN_THOUSAND.toLocaleString()} add & pop`, () => { + const pq = new SRCPriorityQueue({ comparator: (a, b) => b - a }); - for (let i = 0; i < TEN_THOUSAND; i++) pq.add(i); - for (let i = 0; i < TEN_THOUSAND; i++) pq.pop(); -}).add(`CJS PQ ${TEN_THOUSAND.toLocaleString()} add & pop`, () => { - const pq = new CJSPriorityQueue({ comparator: (a, b) => b - a }); + for (let i = 0; i < TEN_THOUSAND; i++) pq.add(i); + for (let i = 0; i < TEN_THOUSAND; i++) pq.pop(); + }) + .add(`CJS PQ ${TEN_THOUSAND.toLocaleString()} add & pop`, () => { + const pq = new CJSPriorityQueue({ comparator: (a, b) => b - a }); - for (let i = 0; i < TEN_THOUSAND; i++) pq.add(i); - for (let i = 0; i < TEN_THOUSAND; i++) pq.pop(); -}).add(`MJS PQ ${TEN_THOUSAND.toLocaleString()} add & pop`, () => { - const pq = new MJSPriorityQueue({ comparator: (a, b) => b - a }); + for (let i = 0; i < TEN_THOUSAND; i++) pq.add(i); + for (let i = 0; i < TEN_THOUSAND; i++) pq.pop(); + }) + .add(`MJS PQ ${TEN_THOUSAND.toLocaleString()} add & pop`, () => { + const pq = new MJSPriorityQueue({ comparator: (a, b) => b - a }); - for (let i = 0; i < TEN_THOUSAND; i++) pq.add(i); - for (let i = 0; i < TEN_THOUSAND; i++) pq.pop(); -}); + for (let i = 0; i < TEN_THOUSAND; i++) pq.add(i); + for (let i = 0; i < TEN_THOUSAND; i++) pq.pop(); + }); if (isCompetitor) { diff --git a/tsup.config.js b/tsup.config.js index c35a824..82f511c 100644 --- a/tsup.config.js +++ b/tsup.config.js @@ -3,7 +3,7 @@ export default [ entryPoints: { "data-structure-typed": "src/index.ts" }, - target: 'es5', + target: 'es6', format: ["iife"], clean: true, sourcemap: true,