3 ms·
Of course you can hide the biggest complexity behind a single function. What I was getting at is that if I see code with a lot of duplication, often it's not o
by carlmr 6y ago
Of course you can hide the biggest complexity behind a single function.
What I was getting at is that if I see code with a lot of duplication, often it's not only the code that's duplicated, but the runtime as well. Then you have people using nested for loops where a dictionary would do to look it up.
Things like this, in the same language and same framework, make things on average faster, and simpler.
And if that piece of badly architected code is fragile and breaks on every change, you will stop trying to find even the low hanging fruit of optimizations that usually pay off, because every change affects multiple different files and you have no tests to see quickly if it still works.
Thinking about your reply again, it's actually the perfect example of this. Since it was a one-liner, it was so simple that it was easy to exchange it for a different one liner with a different framework just to see if it's faster. If you had to spend weeks on replacing frameworks you wouldn't have been able to do this low-hanging fruit of an optimization.
- maccard 6y agoYou've totally missed my point here - the fact is that no amount of low hanging fruit optimisations in the node app, or architectural improvements, or clean code will _ever_ close that 10x gap. Almost all of the decisions you make after the fact (e.g. DRY, DI, composition, and even in many cases data structures) are meaningless on both a macro and micro level compared to the very basic decisions you make - what does it run on. [0] https://stackoverflow.com/questions/40070631/v8-javascript-performance-implications-of-const-let-and-var https://stackoverflow.com/questions/40070631/v8-javascript-p...