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.

Mention toString implementation of R.memoize

See original GitHub issue

Hi,

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:closed
  • Created 7 years ago
  • Comments:11 (9 by maintainers)

github_iconTop GitHub Comments

3reactions
svozzacommented, Mar 13, 2017

Or maybe just add a function called memoizeWith rather than breaking everyone’s code. 😉

2reactions
kedashoecommented, Mar 13, 2017

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').

Read more comments on GitHub >

github_iconTop 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 >

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