[pypy-dev] Speeding up zlib in standard library

Armin Rigo arigo at tunes.org
Sun Apr 1 11:46:40 CEST 2012


Hi Fijal,

On Tue, Mar 27, 2012 at 15:30, Maciej Fijalkowski <fijall at gmail.com> wrote:
> This sounds overly specific to me. What do others think?

It is indeed overly specific, but it may be useful nevertheless.  We
need to rephrase it to point out the specific-vs-general parts.
Something like this:


Q: How can I test and benchmark a modification to RPython?  (As
opposed to a modification done in the source code of the PyPy Python
interpreter)

A: As an example, let's say that you want to tweak
pypy.rlib.rstring.StringBuilder.  This file contains the
implementation for tests only; the real translated implementation is
in pypy.rpython.lltypesystem.rbuilder.  This is tested by
pypy.rpython.test.test_rbuilder.  Be sure that any tweak you do still
passes the existing tests, and if possible, add new tests specifically
for your changes.  (Run the tests with: python test_all.py
rpython/test/test_rbuilder.py)

Then to get benchmarks: based on the existing examples, create a new
StringBuilder benchmark as the file
pypy/translator/targetStringBuilder.py which will time the
functionality --- written as a small RPython program --- and do this:

$ cd pypy/translator/goal/
$ python translate.py targetStringBuilder.py
$ ./targetStringBuilder-c

You don't need to translate the full PyPy Python interpreter to
benchmark every change.  However, you should do it once at the end, to
make sure that no corner case has been missed and that the performance
improvements are visible there as well.


--- Armin


More information about the pypy-dev mailing list