5 ms·
I recommend against optimizing. If you optimize after the fact, you probably already made bad design decisions earlier. Those usually cannot be corrected by an
by fefe23 6y ago
I recommend against optimizing.
If you optimize after the fact, you probably already made bad design decisions earlier. Those usually cannot be corrected by another optimization pass over the code.
It is much more effective and efficient to have a good plan before you start, and make sure not to write inefficient code in the beginning.
It is also much more effective to take the lessons you learned from the first round, throw the code from that round away, and write a new version. However that is only an option if you modularized your project well, so that small modules are replacable without endangering the rest of the project. Writing the new version will go much faster because you now understand the problem better, and it will produce better code because you get rid of questionable design decisions that hold you back in the long term.
Think about what your legacy in this world will be.
Leave the world with better software than you found it with!
- hackerfromthefu 6y agoI agree, I've found these are often a good strategies. As a subtext I think your general perspective is as an experienced developer and not all developers have the experience to write runtime efficient code or components with clean modularized interfaces, so it won't work for everyone.
- archerx 6y agoYou have probably never worked in game dev where there is an art to optimizing to get every last fps out. I feel a lot web apps could use a good optimization pass because there is no reason that so many sites and web apps are so laggy/janky while doing incredibly simple tasks compared to games runinng on the same system.
- fefe23 6y agoI didn't say optimizing code doesn't work or does not yield speed-ups. In fact I am optimizing my own code, too. But I only get ~10% speedup, tops. Because perf is decided at the design level, in the architecture, data structures and algorithms. In fact, if you get massive speedups in your optimization phase, I would view that as a sign that your process has issues. There should not be that much potential left after you wrote the code down. Elite fit on one floppy disk. Do you think they got there by taking a slow implementation and optimizing it? Have you ever used Turbo Pascal? You think you could get that kind of speed by taking an existing pascal compiler and optimizing it a bit?
- hackerfromthefu 6y agoAhhh turbo pascal background, being exposed to the excellent design of that language and libraries helps to build an understanding of creating runtime efficient code! Anders is a guy who really got runtime performance combined with developer efficiency through good architecture.