Re:JavaScript and Node performance coding tips to make appli...
by jcranmer on Tuesday March 13, 2018 @10:20AM
(#16576286)
My recollection is that the nonperformance of try/catch is something specific to the v8 JIT. Historically, the zero-cost exception model of try/catch has you do absolutely nothing with the data until someone throws an exception, at which point you work out how to map the return address to the appropriate catch handler.
Re:JavaScript and Node performance coding tips to make appli...
by tkone on Tuesday March 13, 2018 @11:53AM
(#16577138)
v8 used to not be able to optimize blocks containing try/catch, which is why if you needed it, you relegated it to a function containing just the try/catch block.
but since async/await relies on the use of try/catch, last november's (october?) v8 release can optimize try/catch.
plus, it was only ever a v8 issue, not an issue in javascriptcore nor tracemonkey.
Here is a perf test with various v8 versions (as you noted not only JIT but going going with the authors favorite).
https://github.com/davidmarkclements/v8-perf