4 ms·
Why write inefficient code when it's just as easy to do it right? I also wrote an article about this, if you can write efficient code without sacrificing reada
by fgerschau 6y ago
Why write inefficient code when it's just as easy to do it right?
I also wrote an article about this, if you can write efficient code without sacrificing readability I think it's worth the (small) effort.
https://felixgerschau.com/premature-optimization-javascript https://felixgerschau.com/premature-optimization-javascript
- Etheryte 6y agoNothing you've brought up in the article is actually optimization though? "Use const" and "reuse code" aren't optimizations, they're simply programming. The submitted article is fairly similar in some sense. You address optimization but skip out on the most important step of optimizing - measuring what you need to optimize. Tacking memo, ref and key onto everything isn't free and if those parts of your application weren't the problem you're actually making it slower.
- MaxBarraclough 6y agoIt makes the claim that using const can improve performance. It doesn't properly substantiate this claim though, and it doesn't seem likely that it's true. It makes the same claim about code reuse, with the reasoning that code is more likely to be JIT compiled if it's a single hotspot rather than two, well, 'warm spots'. Again it doesn't properly back up this reasoning.