News for hackers. Stuff that matters.
Re:Performance of ES6 features relative to ES5 by rgrove on Tuesday March 01, 2016 @01:02PM (#11204617)
> Also, I think try/catch preventing optimization was fixed.

Do you have a source for this? Try/catch deopts still bubble up in my Chrome profiling, so it seems like they're still a problem.

Re:Performance of ES6 features relative to ES5 by spankalee on Tuesday March 01, 2016 @03:51PM (#11205955)
V8 uses Turbofan to optimize some functions that Crankshaft couldn't. As of July, `for-of` and `with` were optimized with Turbofan, but not `try-catch`: http://v8project.blogspot.com/2015/07/v8-45-release.html

Since then there's been work on Turbofan support for `try-catch`, but I can't tell if it's been shipped and enabled, so I could be wrong.

Re:Performance of ES6 features relative to ES5 by rgrove on Tuesday March 01, 2016 @10:52PM (#11207982)
Thanks for the link! That post definitely makes it sound like try/catch optimizations are on the way. I didn't know it was being worked on.
Re:Performance of ES6 features relative to ES5 by goldbrick on Tuesday March 01, 2016 @02:08PM (#11205193)
Yes, my understanding is the problem is essentially undefined behavior as exceptions can be caught at any point in the call stack which makes it basically impossible to optimize.
Re:Performance of ES6 features relative to ES5 by bzbarsky on Wednesday March 02, 2016 @12:38AM (#11208286)
It's not impossible at all. try/catch in the non-throwing case is fast in both Firefox (SpiderMonkey) and IE (Chakra); I'm not sure what the state of things is in Safari (JavaScriptCore). In the throwing case you obviously have to do some work, but as long as that case is rare it's not a problem. Contrast with the V8 situation (which they are fixing), where simply having a try/catch in your function at all will deoptimize the function, even if an exception is never actually thrown.

Oh, and one optimization strategy for try catch is even pretty simple to describe in general terms: you need a cheap way to check whether an exception is thrown, and then after every operation that can throw (e.g. a call into the vm to a function that is allowed to throw) you check whether it did. If not, you just move along. If it did, you jump to an out of line path that does cleanup and callstack unwinding. The devil, as usual, is in the details.

Re:Performance of ES6 features relative to ES5 by kgr on Tuesday March 01, 2016 @03:27PM (#11205773)
Java optimizes try/catches.