Re:V8 Optimization Killers
by _greim_ on Wednesday June 25, 2014 @03:53PM
(#7946389)
I actually don't want to memorize any list, unless it's a list of things that are inherently expensive/impossible to optimize in JS, in which case it's worthwhile. I just hate the idea of having to write all my code according to some list-of-the-week. What I want is a list that separates the always-know stuff from the engine-specific-tweaks or might-not-apply-next-year stuff.
[ Parent
| on HN ]
Actually re-reading the article, I see this:
Currently not optimizable:
Generator functions
Functions that contain a for-of statement
Functions that contain a try-catch statement
Functions that contain a try-finally statement
Functions that contain a compound let assignment
Functions that contain a compound const assignment
Functions that contain object literals that contain __proto__, or get or set declarations.
Likely never optimizable:
Functions that contain a debugger statement
Functions that call literally eval()
Functions that contain a with statement
Which I now realize is sort of what I'm looking for.That list won't ever be accurate. The only way to know is to re-run your performance tests every time Google and Mozilla ship new releases.
SpiderMonkey now optimizes a bunch of difficult cases it never optimized before; some of them seemed like they would never get optimized, but now they're fine. V8 does some nice optimizations now that weren't possible before, similarly.