Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Why is IronPython startup time so slow?

I've been using IronPython for a while now, but something which really hampers my development is that it is excruciatingly slow to start up. I love the language and its way of working, but it is frustrating to have to wait upwards of 20 seconds before it starts executing my code.

I have done some digging and it seems to be that the problem is not with the importing, but before that stage.

Thanks.

like image 759
Lucas Jones Avatar asked Jun 18 '09 20:06

Lucas Jones


1 Answers

We're working on fixing this in 2.6. You can download Beta 1 today and you'll probably see a much improved startup time.

The problem is that most of the time is generally spent JITing code. It's especially pronounced if you're on a 64-bit machine because the 64-bit is slower. In 2.6 we now delay compiling things until they're actually run the first time, interpret them if they're only needed once or twice, and we've moved a bunch of code we'd generate at runtime into IronPython.dll so it too benefits from ngen. The bigger the app the bigger an improvement you'll probably see from all of these changes.

If you didn't check the ngen option when installing IronPython you can go back and ngen it from the command line by doing "ngen install ipy.exe". ngen.exe is in C:\Windows\Microsoft.NET\Framework\v2.0.50727\ngen.exe or C:\Windows\Microsoft.NET\Framework64\v2.0.50727\ngen.exe if you're on a 64-bit machine. But it needs to be an administrator command prompt. That'll give you some benefits today on the stable version. If you're on 64-bit you'll need to do this even if you checked the box - there's a bug that was preventing ngen from working correctly on 64-bit.

like image 116
Dino Viehland Avatar answered Sep 18 '22 07:09

Dino Viehland