views:

976

answers:

5

I'm considering embedding IronPython as a scripting language for an application that I'm writing. So to try it out, I downloaded IronPython 2.0 and fired up the interactive interpreter. Just starting the thing up takes about 5 seconds on my Intel Quad Core with 6 Gigs of memory. I can hardly imagine how much of a delay this would be for a less powerful machine.

Based on these benchmarks, it seems as though IronPython's performance actually isn't too terribly bad. Or is it? Have I misconfigured something during installation? Or is this a problem with the interactive interpreter?

+8  A: 

IronPython's performance is really quite good. The startup performance penalty that you get has got to do with the .NET runtime. .NET applications generally have a slow startup time because a lot of assemblies get loaded and some of them (at least some classes) get compiled on the fly.

This is expected behaviour in .NET. Actual runtime performance is much better. Even startup performance can be improved by pre-compiling the IronPython assembly and putting a copy in the GAC: global assembly cache of your machine. This can be done using the gacutil.exe.

Konrad Rudolph
+1  A: 

Start up time and running performance are not directly related. Java applets got most of their reputation for slowness not because the applet ran slowly but because it took the run time minutes to get started. If you are doing a desktop app, I would worry about startup performance. If your running server code where the run time is always up, it isn't an issue.

hacken
+3  A: 

You can also pre-compile the standard library that comes with IronPython to get much better startup performance. There's a pyc.py sample which can do this.

I've just tried this and I get marginally _worse_ performance. No idea why.
Cameron
+2  A: 

The number of cores is not going to make much of a difference to startup perf :)

Startup is particularly slow on a 64-bit operating system because of performance differences between the 32-bit and 64-bit jitters. If you're using a 64-bit OS but don't need a 64-bit process, try the following:

  1. copy ipy.exe to ipy32.exe
  2. use corflags.exe from the Windows SDK to mark ipy32.exe as a 32-bit executable by saying "corflags /32bit+ ipy32.exe".

The 32-bit version should give you much better startup -- though still nowhere near as good as the CPython startup. But this is something we're continuing to work on.

Curt Hagenlocher
+1  A: 

There are improvements in the interpreter startup time in the IronPython code on CodePlex. Although I am still seeing delays when compared to CPython, there is significant improvement.

MattK