[pypy-dev] Performance challenge of mutating class variables

David Edelsohn dje.gcc at gmail.com
Fri May 13 22:10:01 CEST 2011


I mentioned this issue in a private conversation with Carl and he
suggested that I send the details to the mailinglist.

The following blog post is a nice summary of a significant performance
problem in IronPython's early implementation with good links to the
key discussions:

http://ironpython-urls.blogspot.com/2009/05/python-jython-and-ironpython.html

Robert Smallshire implemented OWL Basic in IronPython and experienced
some massive slowdowns relative to CPython and Jython.  IronPython
developer Dino Diehland investigated the problem and wrote an
detailed blog post about the problem and the fix implemented in
IronPython.  The problem was due to the user program's use of a class
variable as a counter, which caused "unfortunate" behavior in the
IronPython implementation -- mutating the variable invalidated the
cache.

PyPy shows a good speedup compared with CPython already, but it is an
interesting corner case.  The smaller testcase created by Robert might
be a good benchmark to add to PyPy Speed Center
(http://www.smallshire.org.uk/sufficientlysmall/2009/05/22/ironpython-2-0-and-jython-2-5-performance-compared-to-python-2-5/).

- David


More information about the pypy-dev mailing list