[Ironpython-users] Poor performance of a c# - Ironpython application

Jimmy Schementi jschementi at gmail.com
Wed May 23 20:40:18 CEST 2012


On Wed, May 23, 2012 at 12:44 PM, Carles F. Julià
<carles.fernandez at upf.edu> wrote:
>> My guess is that it's .NET's JIT compiler. How do you execute the scripts?
>> Are you compiling them and caching the results or re-executing them each
>> time?
>
>
> I compile the script once and then I save a python object in a dynamic
> variable on c#. Then I access the rest of the python code from there all the
> time.

To save the most startup time, you should compile all Python code to a
DLL using clr.CompileModules, and then load that precompiled assembly.
http://ironpython.net/documentation/dotnet/dotnet.html#compiling-python-code-into-an-assembly

Ideally you'd do this with all Python code, including the standard library.

~js


More information about the Ironpython-users mailing list