Re:Simple, correct, fast: in that order
by AstralStorm on Tuesday July 10, 2018 @01:41AM
(#17495727)
Yes, at that point you typically get to apply far reaching architectural changes or switch out the algorithm.
Sometimes it is quicker to start with just that instead of "polishing a turd". You can get it to be shiny but still nowhere near as shiny as gold.
Hope the code is testable and reasonably easy to modify. Otherwise it's going to be a rewrite.
The profile is then useful as a benchmark on real data. If you have enough time, you can turn that into a high level performance test.
Once you've got this pretty optimized and it's still taking up the lion's share of your execution time, you have to look elsewhere (probably changing your overall approach or applying some higher level optimisation) to improve things further.