[IronPython] Speed test

Dino Viehland dinov at exchange.microsoft.com
Wed Apr 19 23:01:34 CEST 2006

If in initializeDB you comment out:

ipEngine1.SetVariable("pred_file", predfile);                                    ipEngine1.Execute(@"db.load_predicates_file(pred_file)");

does it get much faster?  If it doesn't then the problem is squarely an IronPython problem and we'll need to investigate further.

The more static one has some issues...  The GetObjectArray() call will be really expensive if your edges grow to be very big (it'll copy the array).  Maybe that's what you need to do here though (and it looks like edge just grows unbounded as it never gets cleared).

You also might be able to get rid of the Ops.GetEnumerator call for the Tuple, not that that should be very expensive though.

NodesCollection is a StringCollection?

Also, are you taking your performance measurements at the console, or in an imported py file?  In general our performance is much better in imported files than it is at the console.

Do you want to help develop Dynamic languages on CLR? (http://members.microsoft.com/careers/search/details.aspx?JobID=6D4754DE-11F0-45DF-8B78-DC1B43134038)

-----Original Message-----
From: users-bounces at lists.ironpython.com [mailto:users-bounces at lists.ironpython.com] On Behalf Of JoeSox
Sent: Wednesday, April 19, 2006 10:41 AM
To: Discussion of IronPython
Subject: Re: [IronPython] Speed test

On 4/19/06, Dino Viehland <dinov at exchange.microsoft.com> wrote:
> Interop w/ C# shouldn't really cost you that much - it should actually be able to give you speed gains as you fall back into the static world...
> Do you know if most of the time is being spent in the XmlTextReader or in IronPython after that?

It just passes an else and and catch.  I posted the rough draft of the
test method here if you wish to see in more detail

That test method above is a quickly modified version of an another
method that actually passes out a StringCollection.  Sorry, I haven't
modified the code to be more reflective of what it is actually doing.
But I believe I have captured the times correctly.  And it seems to
successfully create the semantic network of the predicate files within
the PythonEngine.

>And I'm having trouble parsing "but things slow down significantly
when I try to enumerate the StringCollection into a PythonEngine".  Is
this just doing a set variable, or are you looping over the collection
and doing a set variable one at a time?

Yes, here is a test method I used using unpp()

Ideally, this C# load_predicate_files() method would actually create
the semantic dictionaries instead of passing the StringCollection
nodes to just unpp().

I did try a more static approach...

But I didn't like the results, could be my own fault though.  It was
very slow esp. when it reached around 3000 predicate lines from the

users mailing list
users at lists.ironpython.com

More information about the Ironpython-users mailing list