mirror: A fast canonicalisation utility for stable object equality
0

Configure Feed

Select the types of activity you want to include in your feed.

chore: benchmarks should not cache the object between runs

Marais Rossouw (Jul 23, 2024, 10:04 AM +1000) ebbe88b0 fe49ab56

+10 -12
+6 -8
bench/index.ts
··· 17 17 }; 18 18 }; 19 19 20 - suite<any>( 20 + suite<unknown>( 21 21 { 22 22 'object-identity'() { 23 - return (o) => identify(o); 23 + return () => identify(getObject()); 24 24 }, 25 25 'object-hash'() { 26 26 const options = { algorithm: 'passthrough', unorderedSets: false }; 27 - 28 - return (o) => objectHash(o, options); 27 + return () => objectHash(getObject(), options); 29 28 }, 30 29 'json-stable-stringify'() { 31 - return (o) => jsonStableStringify(o); 30 + return () => jsonStableStringify(getObject()); 32 31 }, 33 32 'tiny-stable-stringify'() { 34 - return (o) => tinyStableStringify(o); 33 + return () => tinyStableStringify(getObject()); 35 34 }, 36 35 }, 37 36 (run) => { 38 - const o = getObject(); 39 - run(undefined, () => o); 37 + run(undefined); 40 38 }, 41 39 { 42 40 size: 50,
+4 -4
readme.md
··· 52 52 > via the [`/bench`](/bench) directory with deno 1.45.2 53 53 54 54 ``` 55 - ✔ object-identity ~ 13,888,888 ops/sec ± 2.35% 56 - ✔ object-hash ~ 126,262 ops/sec ± 0.20% 57 - ✔ json-stable-stringify ~ 664,893 ops/sec ± 0.51% 58 - ✔ tiny-stable-stringify ~ 642,673 ops/sec ± 0.50% 55 + ✔ object-identity ~ 313,676 ops/sec ± 0.39% 56 + ✔ object-hash ~ 88,873 ops/sec ± 0.16% 57 + ✔ json-stable-stringify ~ 444,839 ops/sec ± 0.41% 58 + ✔ tiny-stable-stringify ~ 520,833 ops/sec ± 0.45% 59 59 ``` 60 60 61 61 > ^ `object-identity` is not as feature-full it's alternatives, specifically around `function`