6 ms·
Funny I have a saying which is very similar: "Make it work, Make it work well, Make it work fast" I would disagree with beauty == performance, most performanc
by neilellis 11y ago
Funny I have a saying which is very similar:
"Make it work, Make it work well, Make it work fast"
I would disagree with beauty == performance, most performance problems I have found to be in the last place I would think them to be :-) On one (moderately large) system it was a hashcode() calculation ;-)
- lostcolony 11y ago'Place I think it to be' is completely orthogonal to beautiful code. :P From my own experience, many, many times, definitely a majority of them, when I have had performance issues, and finally found the bottleneck, and fixed it, my code was more beautiful afterwards. Algorithms were simplified, duplicated effort was removed, etc. One major one in my mind was where code was attempted to be reused, but in doing so it caused an O(n^2) behavior, where an O(n) could have been done instead. Upon finding it, and refactoring it, the code had fewer interdependencies, the logic was far more straightforward, both things I find to make for 'beautiful' code, and it ran far, far faster (from 'this particular operation takes an hour' to 'this particular operation takes < 1 second'). Had I invested time up front after making it work to clean up the code (rather than stop at 'it works, good enough') I would have stumbled upon the same fix, even before seeing the performance issue.
- rakoo 11y agoI believe the common idiom is Make it work Make it right Make it fast http://c2.com/cgi/wiki?MakeItWorkMakeItRightMakeItFast http://c2.com/cgi/wiki?MakeItWorkMakeItRightMakeItFast
- lostcolony 11y agoIt is; Joe was restating it differently ('right' is ambiguous. 'Beautiful' is subjective, but at least a more appropriate adjective for code quality), and also offering the insight that prioritizing code quality also often gives you performance.
- neilellis 11y agoThat's probably where I got it from, somewhere in the mists of time, thanks rakoo!