Pyston v2: 20% faster Python


We’re very excited to release Pyston v2, a faster and highly compatible implementation of the Python programming language. Version 2 is 20% faster than stock Python 3.8 on our macrobenchmarks. More importantly, it is likely to be faster on your code. Pyston v2 can reduce server costs, reduce user latencies, and improve developer productivity.

Pyston v2 is easy to deploy, so if you’re looking for better Python performance, we encourage you to take five minutes and try Pyston. Doing so is one of the easiest ways to speed up your project.

Performance

Pyston v2 provides a noticeable speedup on many workloads while having few drawbacks. Our focus has been on web serving workloads, but Pyston v2 is also faster on other workloads and popular benchmarks.

Our team put together a new public Python macrobenchmark suite that measures the performance of several commonly-used Python projects. The benchmarks in this suite are larger than those found in other Python suites, making them more likely to be representative of real-world applications. Even though this gives us a lower headline number than other projects, we believe it translates to better speedups for real use cases. Pyston v2 still shows sped-up performance on microbenchmarks, being twice as fast as standard Python on tests like chaos.py and nbody.py.

Here are our performance results:

CPython 3.8.5Pyston 2.0PyPy 7.3.2
flaskblogging warmup time [1]n/an/a85s
flaskblogging mean latency5.1ms4.1ms2.5ms
flaskblogging p99 latency6.3ms5.2ms5.8ms
flaskblogging memory usage47MB54MB228MB
djangocms warmup time [1]n/an/a105s
djangocms mean latency14.1ms11.8ms15.9ms
djangocms p99 latency15.0ms12.8ms179ms
djangocms memory usage84MB91MB279MB
pylint performance1x1.16x0.50x
mypy performance1x1.07x [2]unsupported
pytorch performance1x1.00x [2]unsupported
pypy benchmark suite [3]1x1.36x2.48x
Results were collected on an m5.large EC2 instance running Ubuntu 20.04

[1] Warmup time is defined as time until the benchmark reached 95% of peak performance; if it was not distinguishable from noise it is marked “n/a”. Only post-warmup behavior is considered for latency measurement.[2] mypy and PyTorch don’t support automatically building their C extensions from source, so these Pyston numbers use our unsafe compatibility mode

[3] The PyPy benchmark suite was modified to only run the benchmarks that are compatible with Python 3.8