Python vs Speed

So after a few days playing around with python I noticed a few interesting things:

1) PyPy is not always the fastest!

PyPy is an version of Python with a JIT compiler that is supposed to speed-up python code dramatically. It especially is good at optimising loops but has trouble with python modules that are not pure python, but have C/C++ backend libs.

Unfortunately in my case both PyGLET and PyMunk are backed by C/C++ and the event loop of my game is handled by PyGLET and calls events on the python code.

This causes PyPy to not perform as well as CPython in my case.

2) CPython performance is weird???

With my very simple early prototype I am getting weirdly inconsistent frame-rates between runs of the exact same code.

While I usually get a nice smooth 60fps, every now and then it will only run at 20fps for no apparent reason.

This raises the possibility that the finished game will not perform as well as I would like and makes me consider dropping python in general.

Of course that has its own set of problems, while the chipmunk code can be fairly easily ported to c++, changing the windowing/graphics library to something like SDL will be a bit of a pain.