Hacker News new | ask | show | jobs
by LispSporks22 834 days ago
> the developer who had implemented the function said he had heard that if/then was inefficient, so he used try/catch instead

I would love to see that function

1 comments

I want to see the benchmarks that showed try catch as more efficient. It will certainly be Legendary or WTF category
You never see benchmarks after such statements.
I have heard bizarre statements backed up by benchmarks. Eg lodash uses recursion for faster string concatenation for _.repeat() and then proved it was faster.

That said, performance hacks are often temporary: people get one benchmark, update their codebases for 'performance reasons', then the compiler updates and the code is filled with workarounds for an issue that doesn't exist anymore. There's lots of bad JS/TS using other styles because because ES2017 async/await was slow five years ago.