diff --git a/bench/index.ts b/bench/index.ts index c7594ac..1681c3b 100644 --- a/bench/index.ts +++ b/bench/index.ts @@ -17,26 +17,24 @@ const getObject = () => { }; }; -suite( +suite( { 'object-identity'() { - return (o) => identify(o); + return () => identify(getObject()); }, 'object-hash'() { const options = { algorithm: 'passthrough', unorderedSets: false }; - - return (o) => objectHash(o, options); + return () => objectHash(getObject(), options); }, 'json-stable-stringify'() { - return (o) => jsonStableStringify(o); + return () => jsonStableStringify(getObject()); }, 'tiny-stable-stringify'() { - return (o) => tinyStableStringify(o); + return () => tinyStableStringify(getObject()); }, }, (run) => { - const o = getObject(); - run(undefined, () => o); + run(undefined); }, { size: 50, diff --git a/readme.md b/readme.md index 057b7f6..728db21 100644 --- a/readme.md +++ b/readme.md @@ -52,10 +52,10 @@ assert.toEqual(hashA, hashB); > via the [`/bench`](/bench) directory with deno 1.45.2 ``` -✔ object-identity ~ 13,888,888 ops/sec ± 2.35% -✔ object-hash ~ 126,262 ops/sec ± 0.20% -✔ json-stable-stringify ~ 664,893 ops/sec ± 0.51% -✔ tiny-stable-stringify ~ 642,673 ops/sec ± 0.50% +✔ object-identity ~ 313,676 ops/sec ± 0.39% +✔ object-hash ~ 88,873 ops/sec ± 0.16% +✔ json-stable-stringify ~ 444,839 ops/sec ± 0.41% +✔ tiny-stable-stringify ~ 520,833 ops/sec ± 0.45% ``` > ^ `object-identity` is not as feature-full it's alternatives, specifically around `function`