[pypy-dev] Speeding up zlib in standard library

Peter Cock p.j.a.cock at googlemail.com
Mon Mar 12 19:43:21 CET 2012

Hi all,

I am looking at some benchmark numbers from some of my code,
and one area where PyPy is slower than 'C' Python (perhaps twice
as slow) is code making heavy use of the zlib standard library.

I had a look at this page about how C libraries are called from PyPy,
it seems sketchy and perhaps somewhat out of date too. I'd find it
helpful if it commented on what PyPy was using for the standard
library C modules: http://doc.pypy.org/en/latest/extending.html

Looking at the source of the zlib library in pypy,

I see it starts with these imports:

from pypy.interpreter.mixedmodule import MixedModule
from pypy.rlib import rzlib

Which in turn calls the restricted code,

Given http://doc.pypy.org/en/latest/extending.html describes this
mixed module approach as the "most advanced and powerful way"
of calling C code, does that mean in this particular case there are
no low handing fruit to speed up using zlib in PyPy?



More information about the pypy-dev mailing list