[issue14478] Decimal hashing very slow, could be cached
James Hutchison
report at bugs.python.org
Tue Apr 10 19:00:10 CEST 2012
James Hutchison <jamesghutchison at gmail.com> added the comment:
In the patch:
This:
+ except AttributeError:
+ pass
should be:
+ except:
<everything inside except statement>
Checking for the AttributeError is very slightly slower. Not by a lot, but I think if we're going for speed we might as well be as fast as possible. I can't imagine any other exception coming from that try statement.
Using except: pass as opposed to sticking everything inside the except statement is also very slightly slower as well
Simple test case, 10 million loops:
except: 7.140999794006348
except AttributeError: 7.8440001010894775
Exception code
in except: 7.483999967575073
after except/pass: 7.75
----------
_______________________________________
Python tracker <report at bugs.python.org>
<http://bugs.python.org/issue14478>
_______________________________________
More information about the Python-bugs-list
mailing list