-
-
Notifications
You must be signed in to change notification settings - Fork 148
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
Curry performance #101
Comments
Hey @nthypes, can you provide additional context?
|
It's incredible slow and it's not working for real production project! I catch it easy on latest versions of TypeScript and Ramda. Note: I force install to @types/ramda latest ts-toolbelt (6.9.0), it doesn't help Simple code: import * as R from 'ramda';
const fn1 = R.curry((a: string, b: number) => {
return true;
});
const fn2 = R.curry((f1: typeof fn1, f2: typeof fn1) => {
return true;
});
const fn3 = R.curry((f1: typeof fn2, f2: typeof fn2) => {
return true;
});
fn3(
fn3(
fn3()
)
) Errors:
|
Indeed, thanks for reporting this! |
Sometimes hiding behind interfaces instead of types helps the compiler.. (had the same issue in @morphic-ts..) |
Thanks for the advice, I'm looking into it right now |
@darky you have found a sad limitation of this type. I went back to previous versions, and this seems to be a bug. Unfortunately, I don't know how to solve this. Luckily, I am working on new curry types (generated) that will be lighter on the CPU... But I can give you a date for this, sorry. The only thing I can recommend you is to const fn1 = R.curry((a: string, b: number) => {
return true;
}) as any; |
Building types for I'm closing this, as I'm not able to solve your use case, will notify when I moved forward in generating the new types. Again, sorry Cheers |
This looks like the same issue that I've been having (when trying to assign a curried function to a variable with an |
Good news everyone, with the upcoming [email protected] feature microsoft/TypeScript#5453, concat (which curry relies on) is going to get much more performant (as well as prepend, append...) which should bring better overall performance for curry and the rest of the library. However, this still doesn't resolve the issue pointed out by @darky Work is being done on |
@philipbulley Yes, typescript fails at unfolding the type because of it's complexity. This is also why there is no |
Ping veryone, I can confirm that @darky's example now works. |
🐞 Bug Report
Describe the bug
Any benchmark for the Curry type? My CPU is about to explode when I use the curry function from ramda which uses ts-toolbelt.
@nthypes
Reproduce the bug
Expected behavior
Possible Solution
Screenshots
Additional context
The text was updated successfully, but these errors were encountered: