3 ms·
> 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
by LispSporks22 3y 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
- rk06 3y agoI want to see the benchmarks that showed try catch as more efficient. It will certainly be Legendary or WTF category
- carlmr 3y agoYou never see benchmarks after such statements.
- nailer 3y agoI 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.