Wednesday, June 24, 2009

IronPython Performance: On Mono, on x64 and compared to C#

Everyone loves benchmarks, even though they are usually misleading at best. Of course I'm no exception. Here are three snippets of news on IronPython performance that have surfaced over the last week or so.

IronPython 2.0.1 and 2.6 Beta 1 compared to CPython and Jython (posted to Twitpic by felipez) on Mono revision 136556:

Using the pystones benchmark IronPython on Mono clocks in faster than CPython or Jython. Nice.

One particular bugbear of IronPython performance has been startup time. On 64bit Windows the startup time goes from being merely bad to positively ridiculous. This is because the .NET 64bit JIT is slow to do its job and IronPython generates a lot of code needing to be JITed at startup. A lot of work has gone into IronPython 2.6 to improve startup time (by reducing the amount of rule generation done on startup), and this blog entry Dave Fugate explains something they have done specifically to address startup perf on 64bit Windows - and shows off the results:
Allow me to elaborate on this perf gain...Dino made a change recently such that ipy.exe is now strictly a 32-bit only assembly. That is, it gets executed as a 32-bit CLR process on both x86 and x64 operating systems. ipy64.exe, despite what its name might imply, is a platform agnostic assembly matching the old behavior of ipy.exe in the sense that it gets executed as a 32-bit process on 32-bit OSes and 64-bit on 64-bit OSes. At least part of the perf gain here comes from the fact that my simple Hello World program is most definitely not consuming anywhere near 4 gigs of memory, and overall memory consumption goes up for 64-bit processes => remember the size of pointers gets doubled. Just checked and the physical memory working set of ipy.exe was 31K compared to 44K under ipy64.exe for the Hello World program. This ~30% difference in memory consumption helps explain why we get better perf under ipy.exe.
The next blog entry is in Chinese and compares performance of a few operations in IronPython and C#. As you might expect C# is faster in general, but interestingly IronPython is actually faster than C# for reflection.

No comments:

Post a Comment

Note: only a member of this blog may post a comment.