nixpkgs/pkgs/development
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
..
androidndk-pkgs
arduino
beam-modules
bower-modules/generic
chez-modules
compilers Merge pull request #76420 from babariviere/flutter-init 2020-03-29 14:21:40 +01:00
coq-modules Merge pull request #83343 from vbgl/coq-coqhammer-1.1.1 2020-03-28 23:20:37 -04:00
dhall-modules
dotnet-modules/patches
em-modules/generic
go-modules
go-packages
guile-modules
haskell-modules hackage-packages.nix: automatic Haskell package set update 2020-03-27 20:58:22 +01:00
idris-modules idrisPackages: add tf-random package 2020-03-20 13:44:50 +01:00
interpreters cpython: Use --enable-optimizations, for a 16% speedup. 2020-05-11 23:37:04 -07:00
java-modules
libraries Merge pull request #83662 from r-ryantm/auto-update/utf8proc 2020-03-29 21:15:01 +02:00
lisp-modules
lua-modules Revert "luaPackages.luv: 1.30.0-0 -> 1.34.1-1" 2020-03-27 22:19:25 +01:00
misc
mobile
node-packages nodePackages: use node2nix from git 2020-03-28 06:48:56 +00:00
ocaml-modules ocamlPackages.graphics: init at 5.1.0 for OCaml ≥ 4.09 2020-03-23 09:12:50 +01:00
perl-modules
pharo
pure-modules
python-modules pythonPackages.pyarrow: fix test 2020-03-29 10:43:42 -07:00
r-modules
ruby-modules solargraph: 0.38.0 -> 0.38.6 2020-03-27 13:12:16 -07:00
tools Merge pull request #82852 from Mic92/cross-build-rust-package 2020-03-29 14:07:07 +01:00
web Revert "Merge pull request #83099 from marsam/fix-buildGoModule-packages-darwin" 2020-03-27 07:33:21 +00:00