• boonhet@sopuli.xyz
    link
    fedilink
    arrow-up
    7
    ·
    21 hours ago

    Exactly. A 10% decrease in run time for a method is a small optimization most of the time, but whether or not it’s premature depends on whether the optimization has other consequences. Maybe you lose functionality in some edge cases, or maybe it’s actually 10x slower in some edge case. Maybe what you thought was a bit faster, is actually slower in most cases. That’s why you measure when you’re optimizing.

    Maybe you took 3 hours of profiling and made a loop 10% faster but you could have trivially rewritten it to run log n times instead of n times…