3 ms·
> Most of them talk about how you should avoid try/catch in > performant code, even though it's only one engine that doesn't > optimize it That still s
by avar 10y ago
> Most of them talk about how you should avoid try/catch in
> performant code, even though it's only one engine that doesn't
> optimize it
That still sounds like great advice even though it's "only" slow on
one engine. Very few performant JS applications have the luxury of not
worrying about how Chrome performs, as opposed to only IE, Firefox &
Safari.
- Klathmon 10y agoOh it is great advice right now, since Chrome has such large market share and V8 is the only "real" engine on the back end at this time, you'd be dumb to ignore it. My point was that you want multiple competing engines to avoid this kind of thing going from a "V8 thing" to a "Javascript thing". Right now V8 can still fix this "issue" and going forward that will no longer be a problem, but if history was a little different, we could have ended up with no engines that support an optimized try/catch since nobody uses it, and nobody would use it because no engines supported optimizing it.
- Analemma_ 10y agoThe problem is that perf tips have a strong tendency to become "cargo cult knowledge" that keep getting passed around even though no one knows the original reason for their existence, or that they have long since stopped applying. This has been a problem in the C world for ages, and now it looks like it's coming to JavaScript as well. Even if Google were to fix this issue tomorrow, we'd probably still see programmers in 2025 writing convoluted code to avoid try/catch because "it's bad for performance, I heard that somewhere". If Microsoft had released Chakra around the same time, it never would've been an issue, because people would've known "Oh, this is just Google's bug", gotten on their case to fix it, and it would've been gone a long time ago.
- magicalist 10y ago> If Microsoft had released Chakra around the same time, it never would've been an issue, because people would've known "Oh, this is just Google's bug", gotten on their case to fix it, and it would've been gone a long time ago. But this is the exact situation that the browser world is in (V8 is only one vendor among many) and that hasn't come to pass.
- Dr_tldr 10y agoTrue, but one way to push them to fix their engine and make it better is for them to feel pressure to not be left behind. People are going to code in the way that makes sense for them, and if one mainstream-enough implementation works way better than another, eventually people are going to stop bothering with it. Safari has become the new IE in a lot of ways, and larger and larger websites/apps are starting to only target Firefox and Chrome, leaving Apple with the options to either give up or rejoin the mainstream.