[RFC] dirstate walk speedup

Emanuele Aina em at nerd.ocracy.org
Fri Sep 28 08:46:08 CDT 2007

Bryan O'Sullivan velocizzò:

> There are two versions of the osutil module: a pure Python version, 
> which is still faster than the current code that calls os.listdir 
> directly, and a C extension module that does a few extra tricks: it 
> doesn't call lstat at all if it can avoid it, and it calls fstatat 
> instead of lstat if available, reducing dentry lookups.


Unfortunately the C extension does not compile on a Debian i386 32bit 
with Python 2.4, as readdir64 needs _LARGEFILE64_SOURCE to be defined 
and Py_ssize_t exists only in Python >= 2.5. :(

Maybe you already know, but to easily test cold cache performances you 
can free pagecache, dentries and inodes caches with 'echo 3 > 
/proc/sys/vm/drop_caches' (as root).

Also what about using ctypes to minimize the duplication between the 
pure-python and the optimized code?

While on python2.4 it is an external module since python2.5 it has been 
included in the standard library.

Complimenti per l'ottima scelta.

More information about the Mercurial-devel mailing list