On Fri, Aug 15, 2008 at 1:09 PM, Dino Viehland <[EMAIL PROTECTED]> wrote:
> Exceptions (100000): 40% slower
I haven't looked at this one yet.  I do know that we have a number of
bug fixes for our exception handling which will slow it down though.
I don't consider this to be a high priority though.  If we wanted to
focus on exception perf I think we'd want to do something radical
rather than small tweaks to the existing code.  If there's certain
scenarios where exception perf is critical though it'd be interesting
to hear about those and if we can do anything to improve them.

A common python optimization is to replace:

if key in dict:
    dict[key]

with

try:
   dict[key]
except KeyError:
   pass

The reasoning is that the try/except method is faster if no exception
is thrown, i.e. you expect the key to be in the dict most of the time.
I seem to recall that the rule of thumb is 9/10 times key should be in
the dict. In IronPython this would be more like 14/15 I guess. Because
this is a optimization, I'd expect to find it mostly in place where it
matters, like nested loops.

Not saying you should boost exception performance for this reason,
just that there are scenarios where exception perf can be important.

-Dan
_______________________________________________
Users mailing list
Users@lists.ironpython.com
http://lists.ironpython.com/listinfo.cgi/users-ironpython.com

Reply via email to