Author tim.peters
Recipients BTaskaya, Mark.Shannon, eric.snow, gvanrossum, pablogsal, serhiy.storchaka, tim.peters
Date 2021-04-02.21:58:54
SpamBayes Score -1.0
Marked as misclassified Yes
Message-id <1617400734.24.0.305734413512.issue43684@roundup.psfhosted.org>
In-reply-to
Content
"""
My philosophy here (which I learned from Tim Peters in the early 2000s) is that even though each individual improvement has no measurable effect on a general benchmark (as shown in the same comment), the combined effect of a number of tiny improvements can be significant.
"""

And sometimes more so than the naïve sum of their individual contributions! Although this was often much clearer on older architectures and compilers (both more predictable).

Indeed, in the old days I routinely checked "optimizations" in that _slowed_ microbenchmarks, provided they reduced the work on the critical path, and didn't make the code markedly harder to follow (but reducing the critical path usually makes the code clearer!).

Because, sooner or later, compilers will get smart enough to see what I saw, and generate better code. And then these can compound. Like "oh! these three temp variables don't actually need to be materialized at all anymore, and suddenly I have few enough that do need to be materialized that _all_ of them can live in fast registers...". So, at some point, the next seemingly insignificant optimization checked in could _appear_ to have an "inexplicable" benefit, by breaking the bottleneck on _some_ inscrutable HW resource overtaxed on the critical path by the original code.

So optimize for what a smart compiler will eventually do, not what they happen to do today ;-) Profile-guided optimization was a major step in that direction.

Saddest to me: layers of indirection introduced to support marginal features, because "well, they don't slow down pybench by much at all". That's the opposite: over time, they can compound to do worse damage than the sum of their individual burdens.

In the end, Everything Counts™.
History
Date User Action Args
2021-04-02 21:58:54tim.peterssetrecipients: + tim.peters, gvanrossum, Mark.Shannon, eric.snow, serhiy.storchaka, pablogsal, BTaskaya
2021-04-02 21:58:54tim.peterssetmessageid: <1617400734.24.0.305734413512.issue43684@roundup.psfhosted.org>
2021-04-02 21:58:54tim.peterslinkissue43684 messages
2021-04-02 21:58:54tim.peterscreate