diff --git a/README.md b/README.md index 6a1c762..97ccbbd 100644 --- a/README.md +++ b/README.md @@ -984,22 +984,28 @@ concurrently. ## Benchmark +MacBook Pro (15-inch, 2018) + +Processor 2.2 GHz 6-Core Intel Core i7 + +Memory 16 GB 2400 MHz DDR4 + +Graphics Radeon Pro 555X 4 GB + +Intel UHD Graphics 630 1536 MB + macOS Big Sur + Version 11.7.9 -MacBook Pro (15-inch, 2018) -Processor 2.2 GHz 6-Core Intel Core i7 -Memory 16 GB 2400 MHz DDR4 -Graphics Radeon Pro 555X 4 GB -Intel UHD Graphics 630 1536 MB [//]: # (No deletion!!! Start of Replace Section)
heap
test nametime taken (ms)executions per secsample deviation
100,000 add6.46154.913.36e-4
100,000 add & poll31.6231.628.04e-4
-
rb-tree
-
test nametime taken (ms)executions per secsample deviation
100,000 add orderly92.7810.780.00
100,000 add & delete orderly164.956.060.00
100,000 add randomly96.1410.400.00
100,000 add & delete randomly268.323.730.02
100,000 add & get randomly221.234.520.00
100,000 add & iterator130.017.690.01
+
rb-tree
+
test nametime taken (ms)executions per secsample deviation
100,000 add92.8610.770.00
100,000 get112.398.908.37e-4
100,000 iterator30.5632.720.00
100,000 add & delete orderly175.065.710.02
100,000 add & delete randomly263.483.800.00
diff --git a/test/performance/data-structures/binary-tree/rb-tree.test.ts b/test/performance/data-structures/binary-tree/rb-tree.test.ts index dcefa15..298c0ca 100644 --- a/test/performance/data-structures/binary-tree/rb-tree.test.ts +++ b/test/performance/data-structures/binary-tree/rb-tree.test.ts @@ -11,37 +11,28 @@ const randomArray = getRandomIntArray(HUNDRED_THOUSAND, 0, HUNDRED_THOUSAND - 1, const cOrderedMap = new OrderedMap(); suite - .add(`${HUNDRED_THOUSAND.toLocaleString()} add orderly`, () => { + .add(`${HUNDRED_THOUSAND.toLocaleString()} add`, () => { rbTree.clear(); for (let i = 0; i < randomArray.length; i++) rbTree.add(i); }) + .add(`${HUNDRED_THOUSAND.toLocaleString()} get`, () => { + for (let i = 0; i < randomArray.length; i++) rbTree.get(randomArray[i]); + }) + .add(`${HUNDRED_THOUSAND.toLocaleString()} iterator`, () => { + const entries = [...rbTree]; + return entries.length === HUNDRED_THOUSAND; + }) .add(`${HUNDRED_THOUSAND.toLocaleString()} add & delete orderly`, () => { rbTree.clear(); for (let i = 0; i < randomArray.length; i++) rbTree.add(i); for (let i = 0; i < randomArray.length; i++) rbTree.delete(i); }) - .add(`${HUNDRED_THOUSAND.toLocaleString()} add randomly`, () => { - rbTree.clear(); - for (let i = 0; i < randomArray.length; i++) rbTree.add(randomArray[i]); - }) .add(`${HUNDRED_THOUSAND.toLocaleString()} add & delete randomly`, () => { rbTree.clear(); for (let i = 0; i < randomArray.length; i++) rbTree.add(randomArray[i]); for (let i = 0; i < randomArray.length; i++) rbTree.delete(randomArray[i]); - }) - .add(`${HUNDRED_THOUSAND.toLocaleString()} add & get randomly`, () => { - rbTree.clear(); - for (let i = 0; i < randomArray.length; i++) rbTree.add(randomArray[i]); - for (let i = 0; i < randomArray.length; i++) rbTree.get(randomArray[i]); }); -suite.add(`${HUNDRED_THOUSAND.toLocaleString()} add & iterator`, () => { - rbTree.clear(); - for (let i = 0; i < randomArray.length; i++) rbTree.add(randomArray[i]); - const entries = [...rbTree]; - return entries.length === HUNDRED_THOUSAND; -}); - if (isCompetitor) { suite.add(`CPT ${HUNDRED_THOUSAND.toLocaleString()} add`, () => { for (let i = 0; i < randomArray.length; i++) cOrderedMap.setElement(randomArray[i], randomArray[i]);