[pypy-dev] Playing with PyPy and Django

Tin Tvrtković tinchester at gmail.com
Sat Feb 7 00:12:24 CET 2015


Hello, PyPy folks!

While trying to speed up one of my Django sites, I noticed a new version 
of PyPy
had just been released. So I grabbed a fresh download of PyPy 3 (since 
this is
a Python 3 codebase) and tried taking it out for a spin.

However, as far as I can see, whatever I try PyPy is consistently slower 
than
CPython for this.

Since this is a proprietary site, I've basically ripped out all the code 
except
my settings.py and my requirements; and am benchmarking the Django admin 
index.
The results are about the same.

I've set up a small repo that can be used to reproduce the environment:
https://github.com/Tinche/PyPy-Django-Playground. There's additional info in
the README there.

These tests have been carried out on Ubuntu Trusty, 64-bit. CPython 3 is the
system Python, 3.4. PyPy has been downloaded from the official site and
unzipped.

So what I basically do is set up an admin session, and use the Django 
main admin
page. 200 warmup requests, then 100 benchmarked requests, look at the mean
request time.

Some results:

Django's runserver, DEBUG mode:

PyPy3            485.389 [ms]
CPython 3.4      105.777 [ms]

Django's runserver, no debug:

PyPy3             44.661 [ms]
CPython 3.4       18.697 [ms]

Gunicorn, 1 worker, no debug:

PyPy3             28.615 [ms]
CPython 3.4       13.532 [ms]

I don't exactly claim to be an expert on benchmarking, but assuming my site
is similar to the Django admin, CPython's gonna be giving me better 
performance.
Also the debug runserver performance is kinda worrying. Nobody's going to be
running this in production, but it makes development a little slower and 
more
annoying than it should be.

Is there anything to make PyPy more competitive in these kinds of scenarios?

Kind regards,
Tin


More information about the pypy-dev mailing list