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 name | time taken (ms) | executions per sec | sample deviation |
---|
100,000 add | 6.46 | 154.91 | 3.36e-4 |
100,000 add & poll | 31.62 | 31.62 | 8.04e-4 |
-
rb-tree
-
test name | time taken (ms) | executions per sec | sample deviation |
---|
100,000 add orderly | 92.78 | 10.78 | 0.00 |
100,000 add & delete orderly | 164.95 | 6.06 | 0.00 |
100,000 add randomly | 96.14 | 10.40 | 0.00 |
100,000 add & delete randomly | 268.32 | 3.73 | 0.02 |
100,000 add & get randomly | 221.23 | 4.52 | 0.00 |
100,000 add & iterator | 130.01 | 7.69 | 0.01 |
+
rb-tree
+
test name | time taken (ms) | executions per sec | sample deviation |
---|
100,000 add | 92.86 | 10.77 | 0.00 |
100,000 get | 112.39 | 8.90 | 8.37e-4 |
100,000 iterator | 30.56 | 32.72 | 0.00 |
100,000 add & delete orderly | 175.06 | 5.71 | 0.02 |
100,000 add & delete randomly | 263.48 | 3.80 | 0.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]);