On 2020-06-09 08:59, David Holmes wrote:
On 9/06/2020 8:26 am, Claes Redestad wrote:
On 2020-06-09 00:12, Sergey Bylokhov wrote:
On 6/8/20 3:06 pm, Claes Redestad wrote:
Right, -O3 is now likely the default for most files.
I'm not sure you suggest the reported ~2% difference between -Os and
-O2/-O3 as an argument against changing to -O3 by default. It might be
statistically significant - or just noise - but we should at any rate
be wary of overfitting to a particular (micro-)benchmark.
I guess that should be the opposite way round. Some good numbers
other than
noise should be used as an argument of changing -0s to -03 by default.
I think if the differences are all in the noise then that could just as
well be used as an argument for _harmonizing_ the build optimization
strategy with the other platforms. While not easy to quantify,
harmonizing theoretically reduces risk of obscure platform specific
issues, since, while different, different platforms will use similar
optimizations schemes at -O3.
On the third hand "if ain't broke ..."
Seems to me that any change to build flags should be backed up by
a-priori evidence that it is a worthwhile change.
We inherited a build system with a lot of randomness, arbitrarily set
values, and copy/pasted code that had diverged over the year. For MacOS
especially, we inherited the Apple port, which was done with little or
no consideration to the JDK as a whole, but more as a hack to get Java
running on MacOS.
Our approach was to mimick the old build system "bug by bug" (as our
slogan were at the time), and then, when the new framework were in
place, tidy up the code, fix the bugs, and harmonize the components over
time.
The odd choice of optimization target for macOS is part of this legacy.
The method of harmonizing it with all the other platforms is part of our
strategy.
If -Os really is a superior optimization flag, it sure is for more
platforms than macOS; at least all compilations using clang. That might
be the case, but if so, we should change it for all platforms, not just
one. As things stand right now, it's macOS that is the odd man out. And
if -Os and -O3 is rougly the same, we should move macOS to where the
rest of the platforms are, not the other way around.
/Magnus
David
-----
It'd also be good to re-run with the new default: when most
compilation
units change to -O3, which optimization level is ideal for an
individual
compilation unit (such as unsafe.cpp) might very well change, since
what optimizations are available through the build chain can shift
considerably.
Hope we will get some good improvements, otherwise it is better to
use -0s.
I hope so too!
/Claes