Re:Node v6.9.0 (LTS)
by m1sta_ on Tuesday October 18, 2016 @09:48PM
(#12740352)
I'm not debating the point, but how is that possible?
[ Parent
| on HN ]
Re:Node v6.9.0 (LTS)
by bananaoomarang on Wednesday October 19, 2016 @03:09AM
(#12741713)
I'm not sure how it's possible but it's definitely not rare. Lodash' methods are faster than their respective native implementations (Lodash `map` > `Array.prototype.map`).
As a general answer, doing something simple in pure JS can be more efficient than the overhead associated with making a native call from JS. The costs are going to vary depending on how the JIT handles things. That's probably the best general reason though as to how it's possible.
As I understand it, native promises don't make native system calls. They are still pure js. They are just implemented differently from Bluebird which optimizes for the most common use cases.
http://programmers.stackexchange.com/questions/278778/why-ar...
I'm not sure all of it still stands. Bluebird is in C. Native is in javascript.
Edit: i'm wrong
Bluebird isn't written in C. It doesn't even depend on a compiled node addon.
Oh you're right. https://github.com/petkaantonov/bluebird/blob/master/src/pro...