Tim Peters <t...@python.org> added the comment:

"""
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™.

----------
nosy: +tim.peters

_______________________________________
Python tracker <rep...@bugs.python.org>
<https://bugs.python.org/issue43684>
_______________________________________
_______________________________________________
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com

Reply via email to