Mercurial > hg
comparison mercurial/exchange.py @ 34044:b862e6fca7ac
revsetlang: build optimized tree by helper function
This should make optimize() more readable, but it doubles the parsing cost.
(original)
$ python -m timeit -n10000 -s 'from mercurial import revsetlang as L' \
'L.optimize(L.analyze(L.parse("::tip")))'
10000 loops, best of 3: 18.1 usec per loop
(this patch)
$ python -m timeit -n10000 -s 'from mercurial import revsetlang as L' \
'L._treecache.clear(); L.optimize(L.analyze(L.parse("::tip")))'
10000 loops, best of 3: 48.4 usec per loop
30usec isn't dominant compared to the revset evaluation, but that is a cost.
That's why a parsed tree is cached, which can benefit in hgweb or chg server.
author | Yuya Nishihara <yuya@tcha.org> |
---|---|
date | Wed, 17 Feb 2016 21:38:25 +0900 |
parents | 13dc7f29531e |
children | f85dfde1731a |
comparison
equal
deleted
inserted
replaced
34043:90896b61fe26 | 34044:b862e6fca7ac |
---|