question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Investigate a faster hashing algorithm that JSON stable stringify

See original GitHub issue

A quick analysis with a flamegraph shows that safe-stable-stringify is the major bottleneck for this cache.

We should investigate if we could come up with a faster algorithm for hashing objects but with the same properties.

Issue Analytics

  • State:closed
  • Created 2 years ago
  • Reactions:1
  • Comments:9 (8 by maintainers)

github_iconTop GitHub Comments

1reaction
mcollinacommented, Jan 14, 2022

Also, mercurius-js/cache is still using v0.5.0 of async-cache-dedupe. Perhaps we can revisit when it has the newer code?

It has been updated this week.

1reaction
zbo14commented, Jan 12, 2022

another option would be to modify the serialize() function so it constructs/returns a string instead of an object that’s later stringified. Not sure if this is feasible though.

@mcollina does the following screenshot corroborate your findings?

_home_zach_Projects_cache_1576762 0x_flamegraph html (1)

Read more comments on GitHub >

github_iconTop Results From Across the Web

zkldi/fast-json-stable-hash - GitHub
Fast JSON Stable Hash (pronounced fish) is a fast, stable JSON hashing library. Stable. The algorithm is stable for different orders of keys....
Read more >
fast-json-stable-stringify - npm
Start using fast-json-stable-stringify in your project by running `npm i fast-json-stable-stringify`. There are 1259 other projects in the ...
Read more >
fast-json-stable-hash - npm Package Health Analysis - Snyk
Fast JSON Stable Hash (pronounced fish) is a fast, stable JSON hashing library. Stable. The algorithm is stable for different orders of keys....
Read more >
Hash | npm.io
deterministic JSON.stringify() with custom sorting to get deterministic hashes from stringified results, with no public domain dependencies.
Read more >
Which hashing algorithm is best for uniqueness and speed?
I want a hash algorithm designed to be fast, yet remain fairly unique to avoid collisions. algorithms · security · performance · hashing ......
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found