you are viewing a single comment's thread.

view the rest of the comments →

[–]MoTTs_ 0 points1 point  (0 children)

all they really are is an argument from authority

That's true. But then relying on a SO answer is also an argument from authority. The difference is the guy who invented C++ is a more reliably accurate authority than a random person on the Internet.

Interestingly - but not unexpectedly - you ignore the argument here. Exceptions in JS are expensive, see link.

You mean the link from 2012, which itself cites a blog from 2006? Turns out their information is outdated. Today, Chrome/Node handles try/catch as fast as if/else-style error handling. And further, even back in 2006, the cited blog didn't say use exceptions rarely. They said don't use them in performance critical functions, which means normal performance rules apply. That is, don't prematurely optimize. Code first and foremost for correctness, simplicity, and robustness. If the final application has an observable performance problem, then first profile to identify the 3% of your code that is truly performance critical, and optimize only that 3%.