status performance and ... chdir

John Arbash Meinel john at arbash-meinel.com
Wed Sep 10 16:48:04 BST 2008


-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

Robert Collins wrote:
> The nice thing about experiments is you can be staggered by the result.
> 
> Executive summary: we should chdir. Lots.
> 
> I wrote a trivial C program. It does roughly what _walkdirs_utf8 does.
> 

...

> Oh, also some strace data, find and 'readdir' respectively.
> 
> :!strace -c find ~/source/baz/test-repos/mozilla/ -size 0 -size 1
> Process 4980 detached
> % time     seconds  usecs/call     calls    errors syscall
> ------ ----------- ----------- --------- --------- ----------------
>  37.05    0.001425           0     54787           lstat
>  23.69    0.000911           0     11592           getdents
>  13.75    0.000529           0     17342        13 open
>  11.41    0.000439           0     17331           close
>   8.16    0.000314           0     11544           fchdir
>   5.28    0.000203           0      5770           stat
...

> ------ ----------- ----------- --------- --------- ----------------
> 100.00    0.003846                124194        16 total
> 
> :!strace -c ./readdir
> Count: 5769
> Process 4986 detached
> % time     seconds  usecs/call     calls    errors syscall
> ------ ----------- ----------- --------- --------- ----------------
>  63.16    0.004200           0     54785           lstat
>  25.88    0.001721           0     11592           getdents
>   7.25    0.000482           0      5772           open
>   2.23    0.000148           0      5772           close
>   1.49    0.000099           0      5773           fstat
...

> ------ ----------- ----------- --------- --------- ----------------
> 100.00    0.006650                 83723         3 total
> 

So... looking at these numbers, I'm guessing the overhead is in passing long
paths to functions like 'open' and 'lstat'.
I remember something similar on Mac, actually. Where the directory you *start*
in, effected how long "bzr status" took.

For example, doing:

/home/jameinel/PROJECT

was measurably faster than
/home/jameinel/work/dev/repo/PROJECT/

You might try that and see if it effects readdir w/ and w/o chdir.

John
=:->

-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.6 (GNU/Linux)
Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org

iD8DBQFIx+w0JdeBCYSNAAMRAie4AKCr+RqgHnmgjEZcODlU7HaH63nZ/QCgsiuc
4RqivLPPV4P9j2GpmsoD5HE=
=Jdwv
-----END PGP SIGNATURE-----



More information about the bazaar mailing list