Monday 15 April 2019

python - Any big projects using Pypy?




I have a very large heterogeneous Python codebase that uses Django as the front-end. This codebase is deployed alongside several servers that are beginning to show the strain and we're looking for ways to speed things up while we re-architect the codebase, and to keep the new code running fast.




We're currently looking at Pypy but it seems a bit iffy. It has many limitations and requires refactoring a lot of code (can't concatenate strings with "+"?).



Does anyone have experience with it? Are there any large scale websites using it?


Answer



Migration from CPython to PyPy is the last thing you should consider when thinking about web site performance (after architecture, database, caching, distributed queues, etc.). And if you absolutely need code-level optimizations (as shown by thorough profiling), then consider going straight to C/C++ for ultimate speed.



PyPy is mostly compatible with CPython on language and standard library level, but it's incompatible with many CPython C extensions (and the compatible ones may actually work slower). If your site is pure Python and has proper test coverage, you can easily check if it works with PyPy and if it's considerably faster or not. If you don't have tests, things are getting risky. If you use C extensions, you'll face issues and it's likely more trouble than it's worth.



See also:





No comments:

Post a Comment

php - file_get_contents shows unexpected output while reading a file

I want to output an inline jpg image as a base64 encoded string, however when I do this : $contents = file_get_contents($filename); print &q...