Thanks for the suggestion using System.Double.TryParse, this brought my performance metric back up. Here is a dump of some internal instrumentation inside my C# application that is making calls to the IronPython script engine. Values are expressed in exponential notation measuring milliseconds.
Edit: SetProviderType Count: 104851 Min: 1.654300E+000 Max: 6.401880E+001 Total: 1.829214E+005 Edit: SetFeeSchedule Count: 104851 Min: 1.998300E+000 Max: 9.119120E+001 Total: 2.548539E+005 The SetFeeSchedule script was the one I was working on. Previously, this was showing a total value that was in the 6th power (around 15 minutes). This change now executes the script in a quarter of the time. Thanks again, Cory On Tue, Aug 3, 2010 at 12:24 PM, Dino Viehland <di...@microsoft.com> wrote: > I think we still need to make sure that a call to float (and other numeric > primitives) uses light weight exceptions as well for this scenario to > completely > be fast but that should be pretty easy. > > > -----Original Message----- > > From: users-boun...@lists.ironpython.com [mailto:users- > > boun...@lists.ironpython.com] On Behalf Of Dave Fugate > > Sent: Tuesday, August 03, 2010 10:03 AM > > To: Discussion of IronPython > > Subject: Re: [IronPython] Exception Performance > > > > Yup, I think you'll find the situation in IronPython 2.7A1 to be a bit > better > > in this respect: > > D:\rft\vsl\dlr\bin>type blah.py > > from System.Diagnostics import Stopwatch > > t = Stopwatch() > > > > try: > > t.Start() > > x = 1/0 > > except Exception, e: > > t.Stop() > > > > print t.Elapsed.TotalMilliseconds > > > > D:\rft\vsl\dlr\bin>"C:\Program Files (x86)\IronPython 2.6\ipy.exe" > > blah.py > > 2.6096 > > > > D:\rft\vsl\dlr\bin>"C:\Program Files (x86)\IronPython 2.6\ipy.exe" > > blah.py > > 2.4518 > > > > D:\rft\vsl\dlr\bin>"C:\Program Files (x86)\IronPython 2.6\ipy.exe" > > blah.py > > 2.4622 > > > > D:\rft\vsl\dlr\bin>"C:\Program Files (x86)\IronPython 2.7\ipy.exe" > > blah.py > > 0.7887 > > > > D:\rft\vsl\dlr\bin>"C:\Program Files (x86)\IronPython 2.7\ipy.exe" > > blah.py > > 0.7633 > > > > D:\rft\vsl\dlr\bin>"C:\Program Files (x86)\IronPython 2.7\ipy.exe" > > blah.py > > 0.7683 > > > > Dave > > > > > > -----Original Message----- > > From: users-boun...@lists.ironpython.com [mailto:users- > > boun...@lists.ironpython.com] On Behalf Of Jeff Hardy > > Sent: Tuesday, August 03, 2010 8:41 AM > > To: Discussion of IronPython > > Subject: Re: [IronPython] Exception Performance > > > > Hi Cory, > > > > On Mon, Aug 2, 2010 at 12:41 PM, Cory Brostowicz < > cory.brostow...@gmail.com> > > wrote: > > > Hello, > > > I noticed the performance in one of my python scripts has really bad > > > performance, so I started profiling different sections of the script > > > to find out where the issue is. It turns out, the exception handle > > > seems to add the biggest chunk of time. > > > > IronPython 2.6 and earlier rely on the .NET exception mechanism. > > .NET's exception handling is extremely slow, whereas CPython has an > extremely > > fast exception handling system. I don't know the details of why each is > the > > way it is, though - engineering tradeoffs, I guess. > > > > IronPython 2.7 will have a 'lightweight' exception mechanism that should > be > > closer to the performance of CPython. > > > > > I've fairly new to the Python language, so if there is a better way to > > > do what I'm doing, then please let me know. > > > > Unfortunately, I think that's pretty much idiomatic Python, which often > relies > > on it's very fast exception handling. In .NET you use the > > Try* methods instead, which don't throw exceptions. > > > > If you don't need CPython compatibility, you could use > System.Double.TryParse > > (http://msdn.microsoft.com/en-us/library/994c0zb1.aspx), but I don't > know how > > to use out parameters from IronPython off the top of my head. > > > > On an unrelated note, you can write your print statement as: > > > > print "Total: %s RateGet: %s RateSets: %s Exception Handle: %s > > Rate: %s" % (t.Elapsed.TotalMilliseconds, rateGet, rateSet, > > e.Elapsed.TotalMilliseconds, Rate) > > > > - Jeff > > _______________________________________________ > > Users mailing list > > Users@lists.ironpython.com > > http://lists.ironpython.com/listinfo.cgi/users-ironpython.com > > > > _______________________________________________ > > Users mailing list > > Users@lists.ironpython.com > > http://lists.ironpython.com/listinfo.cgi/users-ironpython.com > _______________________________________________ > Users mailing list > Users@lists.ironpython.com > http://lists.ironpython.com/listinfo.cgi/users-ironpython.com >
_______________________________________________ Users mailing list Users@lists.ironpython.com http://lists.ironpython.com/listinfo.cgi/users-ironpython.com