[PATCH 2 of 3] dirstate: test normalize is not None instead of using a no-op lambda

Matt Mackall mpm at selenic.com
Mon Dec 3 16:33:27 CST 2012


On Mon, 2012-12-03 at 14:23 -0800, Siddharth Agarwal wrote:
> # HG changeset patch
> # User Siddharth Agarwal <sid0 at fb.com>
> # Date 1354570962 28800
> # Node ID 98f5d2b441abc677c2b2fbaa3900de2afc193247
> # Parent  8909a6b5f3028378258675aa51a972b8bc0a77f0
> dirstate: test normalize is not None instead of using a no-op lambda
> 
> hg perfstatus -u on a working directory with 170,000 files, without this
> change:
> ! wall 1.869404 comb 1.850000 user 1.170000 sys 0.680000 (best of 6)
> 
> With this change:
> ! wall 1.839561 comb 1.830000 user 1.120000 sys 0.710000 (best of 6)
> 
> +            if normalize is not None:
> +                nf = normalize(normpath(ff), False, True)

$ python -m timeit -s 'n = None' -c 'if n: pass'
100000000 loops, best of 3: 0.0143 usec per loop
$ python -m timeit -s 'n = None' -c 'if n is not None: pass'
100000000 loops, best of 3: 0.0178 usec per loop

-- 
Mathematics is the supreme nostalgia of our time.




More information about the Mercurial-devel mailing list