3 ms·
I haven't witnessed 'abysmal' performance either. Based on some tests I just ran, calling a bound function is only about 25% slower than calling a non-bound one
by jondubois 11y ago
I haven't witnessed 'abysmal' performance either. Based on some tests I just ran, calling a bound function is only about 25% slower than calling a non-bound one. That's pretty reasonable.
Calling bind() on a function doesn't appear to take that much CPU time either.
That said I don't see the applications for currying in JavaScript. It just makes code less readable. It looks like an anti-pattern to me.
- hajile 11y agoAre you sure about those numbers (can you show your code?) Every benchmark I've seen shows a much bigger difference. Here's a jsperf (courtesy of the WayBackMachine) that shows a difference of about 20x+ over normal function calls. https://web.archive.org/web/20141121220218/http://jsperf.com/function-calls-direct-vs-apply-vs-call-vs-bind/33 https://web.archive.org/web/20141121220218/http://jsperf.com...