widelinks && performance
tridge at samba.org
Wed Apr 14 12:57:56 GMT 1999
> This is certainly less expensive than the current mechanism, because
> getwd must open and search each directory until the root, while this
> scheme just stats each directory.
what I forgot to mention is that Samba has a highly optimised
getwd(). It uses a cache of dev/inode numbers mapped to directory
names and in most cases only needs to do a stat(".") in order to
determine the result of getwd().
That means the current method does 3 chdir() calls and 3 stat() calls
in most cases, which is much better than the worst case of algorithms
that walk the tree, but worse than the best case.
You are right that getwd() on some systems in horribly
expensive. That's why we added the getwd cache code :)
More information about the samba-technical