[Speed] CPython 3.7 is now faster than CPython 2.7 on most benchmarks

INADA Naoki songofacandy at gmail.com
Sun Feb 19 01:45:06 EST 2017


On Wed, Feb 8, 2017 at 12:59 AM, Victor Stinner
<victor.stinner at gmail.com> wrote:
> Hi,
>
> FYI CPython 3.7 is now faster than CPython 2.7 on most benchmarks. It
> would be interesting to investigate why 12 benchmarks are still slower
> to check if we missed something obvious.
>
> Comparison, ignoring differences smaller than 10%:
>
> haypo at speed-python$ python3 -m perf compare_to
> 2017-01-03_11-17-2.7-5988caffbff9.json
> 2017-02-06_07-15-default-e06af4027546.json -G --min-speed=10
> Slower (12):
> - python_startup_no_site: 3.11 ms +- 0.02 ms -> 8.33 ms +- 0.04 ms:
> 2.68x slower (+168%)
> - python_startup: 6.42 ms +- 0.04 ms -> 14.1 ms +- 0.1 ms: 2.20x slower (+120%)


The top two slower benchmark is startup.  There are some unavoidable
reasons (io, importlib,
and more rich types based on abc).
But I sent two pull requests reduce cost of site.py.

* http://bugs.python.org/issue29585
* http://bugs.python.org/issue29592

If they are merged, (python_startup - python_startup_no_site) will be
very close to Python 2.7.

For more optimization, I think we need to write some function in C for
importlib.


More information about the Speed mailing list