Port Python code to pypy or whatever for the future


I am wondering how reliable migrating my Python applications to PYPY is. I need to improve the specifics of working with a lot of python based code and twisted modules that I use for scientific monitoring and I am thinking with a future approach.

The Python Foundation does not show improved intentions of CPython using either the pypy or Cython model.

There is no need to reinvent the wheel, but Guido seems to be oblivious to the needs of python users. In this situation, it is difficult to take a direction, what decision to take?

... and finally I don't want to use another programming language.

PD: I'm actually using version 2.7 ...

Edited: My code has been profiled and tested several times, otherwise I wouldn't ask ... Thanks for answering Francis anyway ...

Edited: Would like to know more about this ...

+3


source to share


1 answer


I think you have the wrong impression of CPython. CPython is the reference implementation and will always have the latest Python features and the latest Python versions. Performance is important and CPython's performance has improved dramatically with each minor release. CPython is by far the most "future proof" implementations available today.

However, a very important feature of CPython is its connection to C environments, that is, to run modules written in C that wrap C libraries or contain finely tuned C code that manages manual memory management. Using C modules limits the number of exotic runtime facilities you can do. For example. there is a significant performance limitation in PyPy if you use any Python module written in C, if it works at all!



You can try PyPy, Cython, IronPython, Jython, etc. and see if it works for you, but expect disappointment if you use any C modules.

Instead, you should use the profile of your code and identify any hotspots or inner loops and optimize them. Since you have an IO driven application, I strongly suspect that the bulk of your "slowness" has nothing to do with your Python implementation, but anything to do with IO related activities. It might not be your application that needs tweaking, but the machine it is running on.

+3


source







All Articles