On Fri, May 27, 2005 at 01:49:00PM -0400, Tim Peters wrote: | Under WinXP Python 2.4.1, the global trick (lookup3) is consistently | fastest, and the lexical scope trick (lookup2) is consistently | slowest; this is typical output across 3 runs: Humm... May not be a surprise for you, but in one specific box here, lookup1 is faster than lookup3 with python2.3 (consistent across 10 runs): Python 2.3.5 (#2, May 4 2005, 08:51:39) [GCC 3.3.5 (Debian 1:3.3.5-12)] on linux2 [sidnei@frodo] ~ [15:41:01] $ python2.3 ~/test.py lookup1 0.632889 lookup2 0.676374 lookup3 0.648941 Python 2.4.1 (#2, May 5 2005, 11:32:06) [GCC 3.3.5 (Debian 1:3.3.5-12)] on linux2 [sidnei@frodo] ~ [15:41:15] $ python2.4 ~/test.py lookup1 0.58283 lookup2 0.598244 lookup3 0.560118 On my (oooold) PowerBook though, lookup3 is consistently faster: Python 2.3.5 (#2, May 6 2005, 11:52:38) [GCC 4.0.0 20050413 (prerelease) (Debian 4.0-0pre11)] on linux2 sidnei@cotia:~$ python2.3 test.py lookup1 2.75203 lookup2 2.83231 lookup3 2.60754 Python 2.4.1 (#2, May 5 2005, 10:40:57) [GCC 4.0.0 20050413 (prerelease) (Debian 4.0-0pre11)] on linux2 sidnei@cotia:~$ python2.4 test.py lookup1 2.56144 lookup2 2.65824 lookup3 2.44022 I suspect the compiler might play some role in there <0.125 wink />. -- Sidnei da Silva <sidnei@awkly.org> http://awkly.org - dreamcatching :: making your dreams come true http://www.enfoldsystems.com http://plone.org/about/team#dreamcatcher <dreid> "lispachu, parentheses attack!"