News for hackers. Stuff that matters.
Re:V8 Optimization Killers by killercup on Wednesday June 25, 2014 @08:30AM (#7943477)
Title should probably be "V8 Optimization Killers".
Re:V8 Optimization Killers by Touche on Wednesday June 25, 2014 @08:38AM (#7943512)
I'm really sick of these recent JavaScript performance related posts that only talk about V8.
Re:V8 Optimization Killers by rplnt on Wednesday June 25, 2014 @09:41AM (#7943767)
It's like searching for any js problem on SO and almost every single question containing top answer with response along the lines "use jquery".
Re:V8 Optimization Killers by simonster on Wednesday June 25, 2014 @09:39AM (#7943761)
Here's a page with some performance tips for both V8 and SpiderMonkey: https://github.com/sq/JSIL/wiki/JavaScript-Performance-For-M.... Unfortunately given the pace at which JS engines move it may be slightly out of date.
Re:V8 Optimization Killers by hcho on Wednesday June 25, 2014 @10:41AM (#7944172)
I would hazard a guess that it's because the intended audience is the node js crowd.

Maybe apart from games, most of this is irrelevant for browser side javascript.

Re:V8 Optimization Killers by esailija on Thursday June 26, 2014 @04:11AM (#7948582)
Yes, it's actually a wiki page in a node.js project.
Re:V8 Optimization Killers by netghost on Wednesday June 25, 2014 @10:30AM (#7944083)
It would be nice to see more information about optimizing for IE and Firefox's JS engines, but to be fair, V8 accounts for a large percent of browser JS and all of Node.js as well.
Re:V8 Optimization Killers by warfangle on Wednesday June 25, 2014 @10:41AM (#7944173)
Node.js is the answer, here. Most stuff you do on the client (outside webgl and game calculations) shouldn't be impacted heavily by these kinds of optimization snafus. But if you're trying to get your server to be as performant as possible, these can really kill you if you snafu naïvely.
Re:V8 Optimization Killers by Igglyboo on Wednesday June 25, 2014 @10:28AM (#7944064)
Just a cursory glance at browser stats seems to show chrome as the most popular which would make sense. I highly doubt anyone using internet explorer is coming to SO.
Re:V8 Optimization Killers by BrandonLive on Wednesday June 25, 2014 @12:05PM (#7944798)
Umm, why not? I use IE 11 in day-to-day usage and as my primary dev target. Chrome is god awful on my machine (it sucks on high DPI displays, has terrible touch support, worse/slower UI responsiveness and animations due to single UI thread, etc). I only use it for compat testing.

Also nice that IE doesn't still require prefixes for established things like transition/transform. If only Chrome and others would get around to implementing other useful CSS3 features that IE has (like grid) we might be able to actually use them some day.

Re:V8 Optimization Killers by rockdoe on Wednesday June 25, 2014 @11:00AM (#7944353)
Chrome on iOS doesn't even use V8.
Re:V8 Optimization Killers by jonpacker on Wednesday June 25, 2014 @11:45AM (#7944663)
Chrome on iOS is Safari in a box.
Re:V8 Optimization Killers by hawkice on Wednesday June 25, 2014 @09:18AM (#7943666)
I think the general idea is that asm.js is both well understood and not something a human should ever generate, so why would anyone but a transpiler writer care?
Re:V8 Optimization Killers by arcatek on Wednesday June 25, 2014 @09:42AM (#7943775)
I'm not sure why you're talking about asm.js (I guess you're implying that asm.js is the only Gecko-specific optimization?), but I just want to note that I find it pretty hard to find good documentation about how to code with it.

The "not something a human should ever generate" doesn't seem like a right statement : before a transpiler can generate this kind of code, a human has to understand it.

Re:V8 Optimization Killers by Touche on Wednesday June 25, 2014 @09:36AM (#7943752)
I don't know why you are bring up asm.js.
Re:V8 Optimization Killers by squeaky-clean on Wednesday June 25, 2014 @02:50PM (#7945997)
Well V8 is the one that matters most. More users use Chrome then Firefox, so it's more important on the client-side. And server-side javascript is probably going to be running on V8. Node.js, Google's scripting platforms, all run V8.

It's like complaining if a C++ performance article only tested with GCC. Sure, there's other compilers out there, but that's the big one.

Re:V8 Optimization Killers by sheetjs on Wednesday June 25, 2014 @10:15AM (#7943980)
To be fair, many of these apply to other JS engines as well:

- manipulating `arguments` should be avoided

- when possible, avoid looping over the properties of an object (using `in` or `Object.keys`)

In the process of optimizing for v8, you may expose other bad patterns (e.g. megamorphic functions) whose replacement will boost performance everywhere.

For example, even though https://github.com/petkaantonov/deque was developed and tuned for v8, it is still much faster than alternatives in other engines.

Re:V8 Optimization Killers by bzbarsky on Wednesday June 25, 2014 @01:13PM (#7945328)
While true, some other bits of advice here (like pulling your try/catch into a separate function) are very V8-specific and may well produce _worse_ code in other implementations.

http://jsfiddle.net/G83mW/14/ has a testcase for the try/catch thing that is interesting to compare in different browsers...

Re:V8 Optimization Killers by dang on Wednesday June 25, 2014 @12:39PM (#7945082)
We changed the title to say "V8".