Echo JS 0.11.0

<~>
chris-l 2903 days ago. link 2 points
The advises in this article are good, but the author is wrong in the sense that he actually is not really going against the rule of "premature optimizations".

Donald Knuth said: "We should forget about SMALL EFFICIENCIES, say about 97% of the time: premature optimization is the root of all evil. Yet we should not pass up our opportunities in that critical 3%."
If the speed gains are as huge as a magnitude of 10x or more, then they don't really count as "small efficiencies".

I think Eric S Raymond explains it better here: http://www.catb.org/esr/writings/taoup/html/ch01s06.html#rule_of_optimization

"From tortured code to incomprehensible data layouts, the results of obsessing about speed or memory or disk usage at the expense of transparency and simplicity are everywhere."

So, the rule is more about preventing writing hackish, non-KISS code that is faster than the simple, obvious code (code that is KISS), or at least until you realize there is a bottleneck you have to fix. Keep in mind that on languages like C, you can optimize writing code that is completely non-obvious, using knowledge of how the compiler works, etc.

So the author of this article is NOT giving a bad advice about writing hackish JavaScript code, but instead is about writing the code following good practices! Which is a very good advice!

Replies