Initial naive attempts at optimizations (WIP)#428
Initial naive attempts at optimizations (WIP)#428gaearon wants to merge 5 commits intobabel:masterfrom
Conversation
There was a problem hiding this comment.
why not cache array's length?
There was a problem hiding this comment.
@chicoxyzzy because v8 will do it for you: http://mrale.ph/blog/2014/12/24/array-length-caching.html
There was a problem hiding this comment.
AFAIK it's not an issue with V8, although I may be wrong.
I'm mainly following this guide:
https://github.com/petkaantonov/bluebird/wiki/Optimization-killers
There was a problem hiding this comment.
but there are other javascript engines not only v8
There was a problem hiding this comment.
My use case is running 6to5 in Node via Webpack so that's what I'm optimizing for :-)
There was a problem hiding this comment.
and as you can see here (at the end) bluebird also caches lengths
There was a problem hiding this comment.
I don't think they're caching on purpose. They need to know length to build an array from arguments so it's silly not to use it in the loop if we have it anyway.
arguments is special so caching length there may be beneficial.
This is kinda ugly but it's my first stab at optimizing
traverse. I'm trying to get rid of closures there.With these changes, I'm getting average 195ms over average 210ms on my mini benchmark.
Hope this gets some discussion started & maybe we can find more hot spots.
This is what V8 profiler gave me: