[Dev] performance of prop vs. mod.prop
Heikki Toivonen
heikki at osafoundation.org
Thu Sep 9 19:03:56 PDT 2004
Our coding guidelines state that we should import a whole module rather
than properties of the module. While this tends to make the code more
clear, there is a question about performance.
In other words, is
from mod import prop
# use prop in tight loop
different from
import mod
# use mod.prop in tight loop
I finally decided to measure this, and my tests showed that the second
form (mod.prop) is over two times slower. It is still pretty fast, so
unless you are doing tens of thousands of iterations it probably does
not matter, if even then.
--
Heikki Toivonen
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 249 bytes
Desc: OpenPGP digital signature
Url : http://lists.osafoundation.org/pipermail/chandler-dev/attachments/20040909/3c82e175/signature.pgp
More information about the Dev
mailing list