2 ms·
> I'd take "premature optimization is root of all evil" type of advice with a big grain of salt. Instead of responding by making this a conversation about “pre
by jt2190 4y ago
> I'd take "premature optimization is root of all evil" type of advice with a big grain of salt.
Instead of responding by making this a conversation about “premature optimization”, we might do better by remembering that the Java runtime’s HotSpot compiler does apply automatic optimizations around instance creation.
Instead, we should make sure that (a) we haven’t accidentally taken a bad time measurement because we haven’t given the runtime enough time to see the slow parts of our code and apply it’s optimizations, and (b) that we haven’t accidentally written code that the runtime can’t optimize.
Edit: Perhaps after all of that we still have slow code, but at least we’ve made sure we’re keeping an eye on all of the JVM’s moving parts as we craft our solution.