-
Notifications
You must be signed in to change notification settings - Fork 3k
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
Rename fromCallback to bindCallback #876
Comments
lgtm. Although I'd still rather see a generated function avoiding the closure, and all the objects/created and copying around here. I'd also like to see a benchmark with it - preferably https://github.com/petkaantonov/bluebird/tree/master/benchmark since it simulates exactly the sort of use case we're discussing here (which is why bluebird used it in the first place) that measures the overhead. If it's 2x slower than callbacks I can take the penalty but if it's an order of magnitude slower that might be a problem. |
Can you elaborate here? |
Yes - look at how promisify is implemented in bluebird. A function is generated for the new function and then the JIT gets to optimize it. Meaning bluebird promisifies at almost zero overhead while other libraries typically are a lot slower. This is important if we expect it to be called per-request in servers. On the client it's insignificant though. |
Ah, I see, Bluebird is actually building function via strings. That's what you meant by "generated function". That's an interesting approach, actually. Totally worth investigating for something like this. Thanks @benjamingr for pointing me to that. Hopefully I'll have time soon to try it with some perf tests. |
This thread has been automatically locked since there has not been any recent activity after it was closed. Please open a new issue for related bugs. |
Per the discussion here #787. I think we're in agreement that
fromCallback
's behavior differs enough from the otherfromX
methods that we can change the name.The text was updated successfully, but these errors were encountered: