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: removes hashing tests

Marais Rossouw (Oct 12, 2023, 1:41 PM +1000) 8e2c18d0 dee9f398

+5 -22
+2 -17
bench/index.js
··· 1 1 import { suite } from '@marais/bench'; 2 2 3 - import { createHash } from 'crypto'; 4 3 import objectHash from 'object-hash'; 5 4 import { identify } from 'object-identity'; 6 5 import jsonStableStringify from 'json-stable-stringify'; ··· 18 17 19 18 suite( 20 19 { 21 - ['object-identity']() { 20 + 'object-identity'() { 22 21 return (o) => identify(o); 23 22 }, 24 - ['object-hash']() { 23 + 'object-hash'() { 25 24 const options = { algorithm: 'passthrough', unorderedSets: false }; 26 25 27 26 return (o) => objectHash(o, options); 28 27 }, 29 28 'json-stable-stringify'() { 30 29 return (o) => jsonStableStringify(o); 31 - }, 32 - ['object-identity :: hashed']() { 33 - const hasher = (val) => createHash('sha1').update(val).digest('hex'); 34 - 35 - return (o) => identify(o, hasher); 36 - }, 37 - ['object-hash :: hashed']() { 38 - const options = { 39 - algorithm: 'sha1', 40 - encoding: 'hex', 41 - unorderedSets: false, 42 - }; 43 - 44 - return (o) => objectHash(o, options); 45 30 }, 46 31 }, 47 32 (run) => {
+3 -5
readme.md
··· 58 58 > via the [`/bench`](/bench) directory with Node v18.16.1 (Apple M1 Pro) 59 59 60 60 ``` 61 - ✔ object-identity ~ 55,101,604 ops/sec ± 0.16% 62 - ✔ object-hash ~ 103,820 ops/sec ± 0.01% 63 - ✔ json-stable-stringify ~ 608,119 ops/sec ± 0.01% 64 - ✔ object-identity :: hashed ~ 46,650,067 ops/sec ± 0.05% 65 - ✔ object-hash :: hashed ~ 50,966 ops/sec ± 0.01% 61 + ✔ object-identity ~ 55,252,648 ops/sec ± 0.11% 62 + ✔ object-hash ~ 96,936 ops/sec ± 0.01% 63 + ✔ json-stable-stringify ~ 605,425 ops/sec ± 0.02% 66 64 ``` 67 65 68 66 > ^ `object-identity` is not as feature-full it's alternatives, specifically around `function` values and other node