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.<br>
<br>* AIX 5.3:<br><br>python26 -m timeit -s 'def f(): pass' 'f()'<br>1000000 loops, best of 3: 0.336 usec per loop<br><br>cwd is NFS mount:<br>users/baplepil/sandbox> python26 -m timeit -s 'from os import getcwd' 'getcwd()'<br>
1000 loops, best of 3: 1.09 msec per loop<br><br>cwd is /tmp:<br>/tmp> python26 -m timeit -s 'from os import getcwd' 'getcwd()'<br>1000 loops, best of 3: 323 usec per loop<br><br>* Solaris 10 (Sparc):<br>
python26 -m timeit -s 'def f(): pass' 'f()'<br>1000000 loops, best of 3: 0.495 usec per loop<br><br>cwd is NFS mount:<br>users/baplepil/sandbox> python26 -m timeit -s 'from os import getcwd' 'getcwd()'<br>
100000 loops, best of 3: 12.1 usec per loop<br><br>cwd is /tmp:<br>/tmp> python26 -m timeit -s 'from os import getcwd' 'getcwd()'<br>100000 loops, best of 3: 4.58 usec per loop<br><br>* Windows XP SP2:<br>
<br>python -m timeit -s "def f(): pass; f()"<br>10000000 loops, best of 3: 0.0531 usec per loop<br><br>cwd is network drive (same as previous NFS mount):<br>R:\...\users\baplepil>python -m timeit -s "from os import getcwd" "getcwd()"<br>
100000 loops, best of 3: 5.14 usec per loop<br><br>cwd is C:\temp>:<br>C:\temp>python -m timeit -s "from os import getcwd" "getcwd()"<br>100000 loops, best of 3: 4.27 usec per loop<br>
<br><br><div class="gmail_quote">2010/2/17 Dan Villiom Podlaski Christiansen <span dir="ltr"><<a href="mailto:danchr@gmail.com">danchr@gmail.com</a>></span><br><blockquote class="gmail_quote" style="border-left: 1px solid rgb(204, 204, 204); margin: 0pt 0pt 0pt 0.8ex; padding-left: 1ex;">
<div class="im">On 7 Feb 2010, at 05:27, <a href="mailto:exarkun@twistedmatrix.com">exarkun@twistedmatrix.com</a> wrote:<br>
<br>
> 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.<br></div></blockquote></div><br>