[Python-Dev] __file__ is not always an absolute path
Baptiste Lepilleur
baptiste.lepilleur at gmail.com
Wed Feb 17 14:28:58 CET 2010
I did some quick measures out of curiosity. Performances seems clearly
filesystem and O.S. dependent (and are likely deployment/configuration
dependent). I did each test 3 times to ensure measure where consistent.
Tests were done with ActivePython 2.6.3.7.
* AIX 5.3:
python26 -m timeit -s 'def f(): pass' 'f()'
1000000 loops, best of 3: 0.336 usec per loop
cwd is NFS mount:
users/baplepil/sandbox> python26 -m timeit -s 'from os import getcwd'
'getcwd()'
1000 loops, best of 3: 1.09 msec per loop
cwd is /tmp:
/tmp> python26 -m timeit -s 'from os import getcwd' 'getcwd()'
1000 loops, best of 3: 323 usec per loop
* Solaris 10 (Sparc):
python26 -m timeit -s 'def f(): pass' 'f()'
1000000 loops, best of 3: 0.495 usec per loop
cwd is NFS mount:
users/baplepil/sandbox> python26 -m timeit -s 'from os import getcwd'
'getcwd()'
100000 loops, best of 3: 12.1 usec per loop
cwd is /tmp:
/tmp> python26 -m timeit -s 'from os import getcwd' 'getcwd()'
100000 loops, best of 3: 4.58 usec per loop
* Windows XP SP2:
python -m timeit -s "def f(): pass; f()"
10000000 loops, best of 3: 0.0531 usec per loop
cwd is network drive (same as previous NFS mount):
R:\...\users\baplepil>python -m timeit -s "from os import getcwd" "getcwd()"
100000 loops, best of 3: 5.14 usec per loop
cwd is C:\temp>:
C:\temp>python -m timeit -s "from os import getcwd" "getcwd()"
100000 loops, best of 3: 4.27 usec per loop
2010/2/17 Dan Villiom Podlaski Christiansen <danchr at gmail.com>
> On 7 Feb 2010, at 05:27, exarkun at twistedmatrix.com wrote:
>
> > Do you know of a case where it's actually slow? If not, how convincing
> should this argument really be? Perhaps we can measure it on a few
> platforms before passing judgement.
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.python.org/pipermail/python-dev/attachments/20100217/d1d28822/attachment-0001.htm>
More information about the Python-Dev
mailing list