Mention toString implementation of R.memoize
See original GitHub issueHi,
Looking at the source code, I’ve noticed that R.memoize
uses toString
to memoize the result.
See related issue - https://github.com/ramda/ramda/issues/1384
Would it be an idea to mention this in a documentation? I assume that programmers are using this function in a hope it will increase performance, but in a lots of scenarios, it can actually decrease perf. because toString
is rather expensive operation. Since people don’t check the source code every time, it would be useful to have it stated in a docs I think
I’ll be happy to create a PR if the issue is accepted.
Issue Analytics
- State:
- Created 7 years ago
- Comments:11 (9 by maintainers)
Top Results From Across the Web
Options for caching / memoization / hashing in R
Save this question. Show activity on this post. I am trying to find a simple way to use something like Perl's hash functions...
Read more >Memoize - Make functions faster by trading space for time
`Memoizing' a function makes it faster by trading space for time. It does this by caching the return values of the function in...
Read more >Optimize your R Code using Memoization - R-bloggers
This article describes how you can apply a programming technique, called Memoization, to speed up your R code and solve performance ...
Read more >Memoization is an annoying term : r/ProgrammerHumor - Reddit
You don't need a cache for memoization, but it's one of the way to implement it.
Read more >Kotlin purity and function memoization - Jorge Castillo
I have used a class here so it becomes clearer to read, but I could also create an anonymous object extending the correct...
Read more >
Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free
Top Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Or maybe just add a function called
memoizeWith
rather than breaking everyone’s code. 😉I feel like we should deprecate current memoize and provide a version which takes a user function. As @jvorcak says, if you are memoizing you are trying to help with performance, and this default implementation will hardly ever (never?) beat a specific user supplied function. Very often I would imagine the user function will be simple, eg
prop('id')
.