Live data from Hacker News

JS MythBusters – An optimization handbook from a high level point of view

mythbusters.js.org

1–10 of 27 posts

Re: JS MythBusters – An optimization handbook from a high level point of view

#3
> from a high level point of view

Many of the examples I looked at were very granular and specific, but didn't have much explanation. Does high level point of view really mean brief and without elaboration?

From a high level on JS optimization I would like to see more emphasis on which considerations are most likely to have the biggest impact on my code. Throwing everything in together as if they were all equal seems like it may be missing the point.

Re: JS MythBusters – An optimization handbook from a high level point of view

#5
How many of these optimizations are just limited to V8?

I swear I've heard somewhere that the try/catch limitation is specific to V8, and that other engines don't have that problem. Am I mistaken?

EDIT: Also, this page is very difficult to read. I have a laptop with a great screen and the lack of contrast is annoying.

Re: JS MythBusters – An optimization handbook from a high level point of view

#6
Some of these suggestions are good but some caveats: - Lookup tables- while lookup tables are great, engines might sometimes convert switch statements to lookup tables too- Chakra does this when it's advantageous to do so - Try-catch- this seems like v8 specific advice. Chakra definitely does optimize functions with try-catch in it, and I think SpiderMonkey does too - Freeing memory- setting the reference to null does not necessarily free the memory- it just makes it likelier to get collected when the Garbage Collector runs

Disclaimer: MSFT employee, Engineer on Chakra

Re: JS MythBusters – An optimization handbook from a high level point of view

#7

I think this is not well researched enough. There doesn't appear to be any thought put into optimization vs. readability, and when the optimization improves enough speed to justify the poor readability.

The domain name, js.org, seems to lend more credibility then it should.

Re: JS MythBusters – An optimization handbook from a high level point of view

#8
This handbook assumes that JS execution really is your bottleneck and not network, DOM, what not. I doubt this is the case in the majority of applications, so following these tips might be even counterproductive as they sometimes come at the cost of readability.

Re: JS MythBusters – An optimization handbook from a high level point of view

#9

Some of these suggestions are good but some caveats: - Lookup tables- while lookup tables are great, engines might sometimes convert switch statements to lookup tables too- Chakra does this when it's advantageous to do so - Try-catch- this seems like v8 specific advice. Chakra definitely does optimize functions with try-catch in it, and I think SpiderMonkey does too - Freeing memory- setting the reference to null doe…

> Try-catch- this seems like v8 specific advice. Chakra definitely does optimize functions with try-catch in it, and I think SpiderMonkey does too

http://gs.statcounter.com/ certainly suggests that specifically optimizing for Chrome/V8 will benefit the majority of users (58% not including mobile, 50% including mobile). As with all statistics, take with a grain of salt.

Post reply on HN