[issue14757] INCA: Inline Caching meets Quickening in Python 3.3
report at bugs.python.org
Tue May 8 19:37:56 CEST 2012
New submission from stefan brunthaler <s.brunthaler at uci.edu>:
The attached patch adds quickening based inline caching (INCA) to the CPython 3.3 interpreter. It uses a code generator to generate instruction derivatives using the mako template engine, and a set of utility functions to enable automatic and safe quickening.
The code generator itself resides in "cgen" and the generated files reside in "Python/opt/gen". Auxiliary files resides in "Python/opt" and only minor changes are necessary in ceval.c and places where type feedback is possible (mostly in abstract.c and object.c)
Details of the technique have been published (see my home page: http://www.ics.uci.edu/~sbruntha/.)
On my machine (i7-920 with Intel Turbo Boost disabled) this results in average arithmetic speedups of 1.47 over the vanilla interpreter without threaded code/computed gotos, and 1.13 over an interpreter with threaded code/computed gotos enabled. (Maximal speedups are 1.61 over the vanilla interpreter and 1.17 over the threaded code interpreter.) The optimized interpreter uses 206 instructions which currently only cover the standard library, i.e., there is still ample space left for optimized instruction derivatives for popular applications/libraries, such as NumPy or Django.
Furthermore, based on the purely interpretative nature of the technique, there are no compatibility implications (modulo libraries/modules relying on concrete opcode values---I would guess that such code is rather unlikely, but one never knows...) Additional memory overhead is minimal, too, since the technique only requires space for the new derivatives and is something along the lines of 80-100 KiB.
components: Interpreter Core
title: INCA: Inline Caching meets Quickening in Python 3.3
versions: Python 3.3
Added file: http://bugs.python.org/file25499/20120508-inca.patch
Python tracker <report at bugs.python.org>
More information about the Python-bugs-list