nixpkgs/pkgs
Greg Price f8a8243bd3 cpython: Use --enable-optimizations, for a 16% speedup.
Without this flag, the configure script prints a warning at the end,
like this (reformatted):

  If you want a release build with all stable optimizations active
  (PGO, etc), please run ./configure --enable-optimizations

We're doing a build to distribute to people for day-to-day use,
doing things other than developing the Python interpreter.  So
that's certainly a release build -- we're the target audience for
this recommendation.

---

And, trying it out, upstream isn't kidding!  I ran the standard
benchmark suite that the CPython developers use for performance
work, "pyperformance".  Following its usage instructions:
  https://pyperformance.readthedocs.io/usage.html
I ran the whole suite, like so:

  $ nix-shell -p ./result."$variant" --run '
      cd $(mktemp -d); python -m venv venv; . venv/bin/activate
      pip install pyperformance
      pyperformance run -o ~/tmp/result.'"$variant"'.json
    '

and then examined the results with commands like:

  $ python -m pyperf compare_to --table -G \
      ~/tmp/result.{$before,$after}.json

Across all the benchmarks in the suite, the median speedup was 16%.
(Meaning 1.16x faster; 14% less time).

The middle half of them ranged from a 13% to a 22% speedup.

Each of the 60 benchmarks in the suite got faster, by speedups
ranging from 3% to 53%.

---

One reason this isn't just the default to begin with is that, until
recently, it made the build a lot slower.  What it does is turn on
profile-guided optimization, which means first build for profiling,
then run some task to get a profile, then build again using the
profile.  And, short of further customization, the task it would use
would be nearly the full test suite, which includes a lot of
expensive and slow tests, and can easily take half an hour to run.

Happily, in 2019 an upstream developer did the work to carefully
select a more appropriate set of tests to use for the profile:
  https://github.com/python/cpython/commit/4e16a4a31
  https://bugs.python.org/issue36044
This suite takes just 2 minutes to run.  And the resulting final
build is actually slightly faster than with the much longer suite,
at least as measured by those standard "pyperformance" benchmarks.
That work went into the 3.8 release, but the same list works great
if used on older releases too.

So, start passing that --enable-optimizations flag; and backport
that good-for-PGO set of tests, so that we use it on all releases.
2020-05-11 23:37:04 -07:00
..
applications Merge pull request #83648 from r-ryantm/auto-update/pdfsam-basic 2020-03-29 12:58:31 -07:00
build-support buildRustCrate: Add tests for checking files in outputs. 2020-03-29 13:00:21 +02:00
common-updater
data iconpack-jade: init at 1.22 2020-03-29 14:09:33 +02:00
desktops Merge pull request #83684 from romildo/fix.xfce4-hardware-monitor-plugin 2020-03-29 13:08:04 -04:00
development cpython: Use --enable-optimizations, for a 16% speedup. 2020-05-11 23:37:04 -07:00
games Merge pull request #83706 from 7c6f434c/pingus-fix 2020-03-29 20:03:49 +00:00
misc Merge pull request #83638 from veprbl/pr/higan_darwin_fix 2020-03-29 06:42:33 +01:00
os-specific linux: 5.6-rc5 -> 5.6-rc7 2020-03-29 16:50:02 -04:00
servers Merge pull request #82509 from Izorkin/samba4 2020-03-29 18:30:41 +02:00
shells Merge pull request #83397 from marsam/update-xonsh 2020-03-28 14:43:26 +01:00
stdenv armv{5tel,6l,7l}: bootstrap-files: quote URLs for rfc-45 2020-03-16 19:04:39 -04:00
test
tools Merge pull request #82852 from Mic92/cross-build-rust-package 2020-03-29 14:07:07 +01:00
top-level Revert "make-tarball.nix: Restore the 'commit' field in packages.json" 2020-03-29 20:57:50 +02:00