SymPy (a pure Python library) runs multiple times slower than in CPython
Created originally on Bitbucket by BlaXpirit (Oleh Prypin)
Once upon a time, when I realized that my program runs slowly, I decided to give PyPy a go. Long story short, it ran much longer under PyPy than under CPython.
I took a part of the program and simplified it into a short example (attached) that still reproduces the problem.
The startup time is about 5 times longer, which is not very surprising, but the rest of the program runs about 2.5 times slower!
#!bash time pypy test.py time pypy3 test.py real 0m17.947s real 0m24.608s user 0m17.350s user 0m24.407s sys 0m0.163s sys 0m0.100s time python2 test.py time python3 test.py real 0m6.889s real 0m7.411s user 0m6.803s user 0m7.353s sys 0m0.067s sys 0m0.040s
The program uses the library SymPy (can be installed with
pip install sympy or perhaps simply downloaded and extracted to the same folder).