3 ms·
What is the catch with PyPy? If it was a drop-in replacement for CPython, wouldn't everyone choose it as the de-facto version of Python?
by slekker 3y ago
What is the catch with PyPy? If it was a drop-in replacement for CPython, wouldn't everyone choose it as the de-facto version of Python?
- cpburns2009 3y agoSome c modules are incompatible with PyPy. Two common ones are psycopg2 (PostgreSQL driver) and pyodbc (ODBC driver). There are alternatives that work but they don't have quite as many features (psycopg2cffi and pypyodbc). Ansible also runs slower in PyPy than CPython.
- jdsalaro 3y ago> Ansible also runs slower in PyPy than CPython Do you know the reason?
- cpburns2009 3y agoI tested this with a playbook that installs a set of scripts and dependencies on a server. In all there's ~30 tasks. It takes ~1 minute using CPython 3.10 and ~1.5 minutes using PyPy 3.10 (v7.3.12). Ansible says libyaml is installed in both runtimes so that's ruled out. I wonder if it's the difference in interpreter start-up time, and it accumulates over time as Ansible starts so many Python processes as it runs its tasks.
- aeyes 3y agoIt's hit and miss. Sometimes I get almost no improvement and sometimes I get 10x. But the slow warmup and up to 3x memory use (in my experience) really make me prefer CPython unless I have a very specific problem.