[pypy-dev] gothenburg sprint report #2

Michael Hudson mwh at python.net
Sun Dec 11 21:36:21 CET 2005

So, the sprint is over, we are on a ferry but we *still* haven't
escaped the internet...

Christian and Richard spent the last couple of days thinking hard
about the many possible ways of exposing stackless features to
application-level and by the end of the sprint had pretty much
considered them all.  This means they will have no choice but to write
some code for the mixed module soon :)

Armin and his team of helpers (well, mostly Michael and Samuele to be
honest) continued to work on JIT-related things, and continued to
manufacture both working code and extremely strange bugs.  Eventually
the Test Driven Development style was halted for a quick but useful
Cafe-cake-and-thinking-hard Driven Development moment (also attended
by Carl).  By the end of the sprint there was support in the abstract
interpreter for "virtual structures" and "virtual arrays" which are
the abstract interpreter's way of handling objects that are usually
allocated on the memory heap but are sufficiently known ahead of time
for actual allocation to be unnecessary.  Now that probably didn't
make much sense, so here's an example:

     def f(x):
         l = [x]
         return l[0]

When CPython executes this code it allocates a list, places x into it,
extracts it again and throws the list away.  When the abstract
interpeter sees the statement "l = [x]" it just records the
information that "l is a list containing x" so when it sees "l[0]" it
already knows what this is -- just "x".  Then as nothing in the
function ever needed l as a list, it just evaporates.

Anders L and Nik continued on the socket module and managed to write a
test that contained a simple server and client that could successfully
talk to each other (after fighting some mysterious problems that
with processes that refused to die).

Carl continued his work on __del__, implementing support for it in the
C backend when using the Boehm garbage collector which had the minor
disadvantage of slowing pypy-c down by a factor of ten, as every
instance of a user-defined class was registered with the GC as having
a finalizer.  This is apparently not something that the Boehm GC
appreciates, so on Sunday Carl and Samuele implemented a different
strategy.  Now only instances of user-defined classes that actually
define __del__ (at class definition time, no sneaky cls.__del__ = ...
nonsense) get registered as needing finalization.  Carl was also
awarded his first "obscure Python bug" medal for making CPython dump
core when he tried to test a hacky way to implement weakrefs (now SF
bug #1377858).

Arre and Eric continued their optimization drive and implemented a
'fastcall' path for both functions and methods which accelerates the
common case of calling a Python function or method with the correct,
fixed number of arguments.  This improved the results of a simple
function-call benchmark by a factor of about two.  Result!

A notable feature of this sprint is that Armin and Christian were
implementing things very much like other things they had implemented
before, painfully, in C -- namely stackless and psyco -- again, but
this time in Python, and much more enjoyably :) Even more than this,
they both managed to work their way through designs and ideas that had
taken months to sort through the first time in days or even hours.
We'd love to attribute all this to the magical qualities of Python but
practice probably counts for something too :)

So another sprint ends, and a productive one at that.  As usual, we
all need to sleep for a week, or at least until pypy-sync on

mwh & Carl Friedrich

More information about the Pypy-dev mailing list