Re:Trine – A utility library for functional programming in J...
by vkjv on Thursday June 11, 2015 @12:40PM
(#9700737)
I agree, but closures and bine are expensive--present in both cases. It's better to avoid it. Granted, this is a contrived example and sometimes closures are the more elegant solution.
http://jsperf.com/bind-vs-closure-vs-param
[ Parent
| on HN ]
Re:Trine – A utility library for functional programming in J...
by Nemcue on Thursday June 11, 2015 @04:18PM
(#9702105)
Ugh — this plague again. No other coding community has latched on to performance tests like the javascript one. For NO GOOD REASON.
They're not expensive. You're not binding thousands of times a second anyway, so stop your silly premature optimizations.
Re:Trine – A utility library for functional programming in J...
by vkjv on Monday June 15, 2015 @11:08AM
(#9719789)
1. I already gave an out for your point. Yes, always weigh performance vs. clarity and don't over optimize.
2. You are making an assumption that you aren't binding thousands of times a second. You need to take actual use case into consideration.
3. My example has a 1000:1 method call to bind ratio and it's still a significant difference in benchmarks. Yes, it's that expensive it's important to think about in critical sections of code.