[Ironpython-users] Poor performance of a c# - Ironpython application
Steve Dower
s.j.dower at gmail.com
Wed May 23 22:41:15 CEST 2012
I'll throw in that exceptions are much faster in CPython than
IronPython (.NET generally), so if you have any exceptions being
thrown you'll want to find ways to avoid (not just handle) them.
On Thu, May 24, 2012 at 4:46 AM, Dino Viehland <dinov at microsoft.com> wrote:
> This will help with startup, but not necessarily with throughput (it might actually
> hurt it!). But it can also help w/ profiling because if you're pre-compiled you
> can see the hot method names.
>
> I'd suggest to look out for the following things:
> Are you re-using the ScriptEngine or re-creating it? You should be re-using it as much as possible, they're expensive to create.
>
> You could be doing something which is invalidating rules a lot. For example if you are defining a class in a loop and returning a new instance of a new class every time through Ipy's performance would be noticeably worse. You could see this just by profiling your app in VS and see if there's a lot of time being spend under an Update* method in the DLR which then calls into the IronPython runtime and is spending a lot of time in a Bind* method. If you see that you can report back the Bind method which is spending all the time and we can discuss the patterns in your code.
>
> Something else? Always helpful to run the profiler and see where the time is spent. You can use the pre-compiling to get more insight about where the time is spent in the Python code in addition to the DLR and IronPython runtimes.
>
>
>> -----Original Message-----
>> From: ironpython-users-bounces+dinov=microsoft.com at python.org
>> [mailto:ironpython-users-bounces+dinov=microsoft.com at python.org] On
>> Behalf Of Jimmy Schementi
>> Sent: Wednesday, May 23, 2012 11:40 AM
>> To: Carles F. Julià
>> Cc: ironpython-users at python.org
>> Subject: Re: [Ironpython-users] Poor performance of a c# - Ironpython
>> application
>>
>> 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
>> _______________________________________________
>> Ironpython-users mailing list
>> Ironpython-users at python.org
>> http://mail.python.org/mailman/listinfo/ironpython-users
>>
>>
>
>
>
> _______________________________________________
> Ironpython-users mailing list
> Ironpython-users at python.org
> http://mail.python.org/mailman/listinfo/ironpython-users
More information about the Ironpython-users
mailing list