Comment on JS performance: try / catch versus checking for undefined parentComments−porlw14yThat's true - how about repeating the test with valid code that DOESN'T throw an exception.- Edit -Just tried it, it's not even close (on FF4):tryCatch with undef - ~55,000ifCheck with undef - ~2,000,000tryCatch with Object - ~100,000,000ifCheck with Object - ~2,000,000So if an error is not thrown the try/catch expression is WAY faster.
Comments
That's true - how about repeating the test with valid code that DOESN'T throw an exception.
- Edit -
Just tried it, it's not even close (on FF4):
tryCatch with undef - ~55,000
ifCheck with undef - ~2,000,000
tryCatch with Object - ~100,000,000
ifCheck with Object - ~2,000,000
So if an error is not thrown the try/catch expression is WAY faster.