[RFC] speed up walk of working dir by 20-25%

Matt Mackall mpm at selenic.com
Tue Jun 13 17:05:13 UTC 2006


On Tue, Jun 13, 2006 at 07:57:16AM -0700, Vadim Gelfer wrote:
> this patch uses c extension to make walk of working directory faster.
> 
> approach is to read directory in c, use dirent.d_type to tell what type a
> file is without calling lstat. for "hg status", this reduces number of calls
> to lstat by 10% on kernel repo (no need to lstat directories). for "hg add",
> this makes all 20000 calls to lstat go away (no need to lstat anything).
> 
> timings from kernel repo on my computer.
> 
> hg add      2.17s -> 1.61s
> hg status   1.89s -> 1.54s
> 
> i wrote extension using pyrex because is so much like python, but still fast
> like c.
> 
> if people like idea of patch, i will do more tuning and find way to use
> distutils to build this when dirent.d_type is there. please comment.

Not an unreasonable thing to do. But is this portable to anything but Linux?

-- 
Mathematics is the supreme nostalgia of our time.



More information about the Mercurial mailing list