4 ms·
Yep, try/catch is optimized since node v8. The biggest takeaway from the latest batch of optimizations I read about is this: Write idiomatic JavaScript code!
by davedx 9y ago
Yep, try/catch is optimized since node v8.
The biggest takeaway from the latest batch of optimizations I read about is this:
Write idiomatic JavaScript code!
Secondly:
Just because you're working with a dynamic language doesn't mean you should abuse it. Don't write functions with weirdly changing parameter arities, or dynamically change the types of variables.
Finally:
These things are all hints and micro-optimizations by themselves. Don't prematurely optimize at the cost of readability and maintenance. Profile and only fix things that need fixing!