From b7357def444325cf06dd65cd95724d377c93d532 Mon Sep 17 00:00:00 2001 From: Revone Date: Sun, 19 Nov 2023 21:30:17 +0800 Subject: [PATCH] test: HashMap test case conducted on million data --- .../data-structures/hash/hash-map.test.ts | 22 +++++++++---------- 1 file changed, 11 insertions(+), 11 deletions(-) diff --git a/test/performance/data-structures/hash/hash-map.test.ts b/test/performance/data-structures/hash/hash-map.test.ts index b98890f..a48c842 100644 --- a/test/performance/data-structures/hash/hash-map.test.ts +++ b/test/performance/data-structures/hash/hash-map.test.ts @@ -5,42 +5,42 @@ import { magnitude } from '../../../utils'; import { isCompetitor } from '../../../config'; const suite = new Benchmark.Suite(); -const { TEN_THOUSAND } = magnitude; +const { MILLION } = magnitude; -suite.add(`${TEN_THOUSAND.toLocaleString()} set`, () => { +suite.add(`${MILLION.toLocaleString()} set`, () => { const hm = new HashMap(); - for (let i = 0; i < TEN_THOUSAND; i++) { + for (let i = 0; i < MILLION; i++) { hm.set(i, i); } }); if (isCompetitor) { - suite.add(`${TEN_THOUSAND.toLocaleString()} CPT set`, () => { + suite.add(`${MILLION.toLocaleString()} CPT set`, () => { const hm = new CHashMap(); - for (let i = 0; i < TEN_THOUSAND; i++) { + for (let i = 0; i < MILLION; i++) { hm.setElement(i, i); } }); } -suite.add(`${TEN_THOUSAND.toLocaleString()} set & get`, () => { +suite.add(`${MILLION.toLocaleString()} set & get`, () => { const hm = new HashMap(); - for (let i = 0; i < TEN_THOUSAND; i++) { + for (let i = 0; i < MILLION; i++) { hm.set(i, i); } - for (let i = 0; i < TEN_THOUSAND; i++) { + for (let i = 0; i < MILLION; i++) { hm.get(i); } }); if (isCompetitor) { - suite.add(`${TEN_THOUSAND.toLocaleString()} CPT set & get`, () => { + suite.add(`${MILLION.toLocaleString()} CPT set & get`, () => { const hm = new CHashMap(); - for (let i = 0; i < TEN_THOUSAND; i++) { + for (let i = 0; i < MILLION; i++) { hm.setElement(i, i); } - for (let i = 0; i < TEN_THOUSAND; i++) { + for (let i = 0; i < MILLION; i++) { hm.getElementByKey(i); } });