Jeremy Hylton : weblog : 2003-12-09

IronPython performance looks good

Tuesday, December 09, 2003, 10:10 a.m.

Jim Hugunin is at it again: The early results with IronPython show that Python compiled to IL can run fast. On the standard pystone benchmark, IronPython-0.1 is 70% faster than CPython-2.3.

An earlier Python for .NET project at ActiveState ran slowly, but the project report didn't offer a convincing explanation for the slowness: The Microsoft support staff used their internal tools to determine that the IPyType interface lookup for a given .NET object is the biggest hot spot in the runtime. That is, the analysis was disconnected from the development.

Jim's message to the dotnet-language-dev group includes the following microbenchmark results:

                IronPython-0.1  Python-2.3      Python-2.1      Jython-2.1
pystone         0.58            1.00            1.29            1.61

function call   0.19            1.00            1.12            1.33
integer add     0.59            1.00            1.18            1.08
string.replace  0.92            1.00            1.00            1.40
range(bigint)   5.57            1.00            1.09            16.02
eval("2+2")     66.97           1.00            1.58            91.33

It's nice to see that function calls are so much faster. There's a lot of overhead in CPython for function calls -- pushing arguments on the stack, copying them into the callees frame, finding the right builtins for the callee frame, initializing the rest of the frame. It seems like their ought to be a simpler way, at least in the common case.