Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Remove fast-memoize from docs #663

Merged
merged 2 commits into from
Aug 23, 2021
Merged

Remove fast-memoize from docs #663

merged 2 commits into from
Aug 23, 2021

Conversation

mfbx9da4
Copy link
Contributor

@mfbx9da4 mfbx9da4 commented May 11, 2021

I would strongly recommend against using fast-memoize in these docs. It will jsonify the incoming argument parameters. The user is likely to be memoizing against large state objects. The cost of stringifying these large objects could easily outweigh the performance benefits of memoization.

fast-memoize is well benchmarked for use cases when you are memoizing a function which takes small integers as arguments. fast-memoize benchmarking also does not incorporate key deletion or any polymorphic pressure exerted on the engine. For easy peasy, most of the time in my experience, you are memoizing large objects as keys in the memoized cache. Memoizerific and other memoization libraries are able to cache objects effectively because the javascript engine stores a random ID on every object and ES6 Map is able to use that ID. Therefore object lookup in a Map will amount to an integer comparison whereas with fast-memoize this comparison will amount to serializing the entire object and then comparing long strings.

@codecov
Copy link

codecov bot commented May 11, 2021

Codecov Report

Merging #663 (f174fe4) into master (5c4c0e8) will not change coverage.
The diff coverage is n/a.

Impacted file tree graph

@@           Coverage Diff           @@
##           master     #663   +/-   ##
=======================================
  Coverage   94.97%   94.97%           
=======================================
  Files          18       18           
  Lines         696      696           
  Branches      139      139           
=======================================
  Hits          661      661           
  Misses         30       30           
  Partials        5        5           

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update 5c4c0e8...f174fe4. Read the comment docs.

@ctrlplusb
Copy link
Owner

Excellent insight. 🙏

@ctrlplusb ctrlplusb merged commit a53dfa2 into ctrlplusb:master Aug 23, 2021
jmyrland pushed a commit that referenced this pull request Sep 16, 2022
* improve memoize docs

* fix link
jmyrland pushed a commit that referenced this pull request Sep 16, 2022
* improve memoize docs

* fix link
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants