3 ms·
how is this better than: void DoActionOptimized() { ... }
by joshka 11y ago
how is this better than:
void DoActionOptimized() {
...
}
- zachsnow 11y agoOptimized how? Faster? Less memory? Something more subtle?
- joshka 11y agoThat's what naming is for. MemoryOptimizedFoo, FastFoo, ...
- lomnakkus 11y agoIn fact you might also want the un-optimized code around and run the optimized version "against" the un-optimized version (in tests) to see if they actually do the same thing.
- codingdave 11y agoBecause at one point, the code was not optimized, so it already had a function name. Are you really going to rename all instances where that function is called so it is named based on a single commit, instead of its actual purpose?
- joshka 11y agoThere are many ways that are non breaking to implement this. I chose a particular one for example's sake. In reality, extracting an interface is a more valuable refactoring, and a likely valid one given that the optimization tradeoff is happening. So MemoryOptimizedFoo : IFoo, SpeedOptimizedFoo : IFoo...