revset: use phasecache.getrevset
This is part of a refactoring that moves some phase query optimization from
revset.py to phases.py. See the previous patch for motivation.
This patch changes revset code to use phasecache.getrevset so it no longer
accesses the private field: _phasecache._phasesets directly.
For performance impact, this patch was tested using the following query, on
my hg-committed repo:
for i in 'public()' 'not public()' 'draft()' 'not draft()'; do
echo $i;
hg perfrevset "$i";
hg perfrevset "$i" --hidden;
done
For the CPython implementation, most operations are unchanged (within
+/- 1%), while "not public()" and "draft()" is noticeably faster on an
unfiltered repo. It may be because the new code avoids a set copy if
filteredrevs is empty.
revset | public() | not public() | draft() | not draft()
hidden | yes | no | yes | no | yes | no | yes | no
------------------------------------------------------------------
before | 19006 | 17352 | 239 | 286 | 180 | 228 | 7690 | 5745
after | 19137 | 17231 | 240 | 207 | 182 | 150 | 7687 | 5658
delta | | -38% | | -52% |
(timed in microseconds)
For the pure Python implementation, some operations are faster while "not
draft()" is noticeably slower:
revset | public() | not public() | draft() | not draft()
hidden | yes | no | yes | no | yes | no | yes | no
------------------------------------------------------------------------
before | 18852 | 17183 | 17758 | 15921 | 17505 | 15973 | 41521 | 39822
after | 18924 | 17380 | 17558 | 14545 | 16727 | 13593 | 48356 | 43992
delta | | -9% | -5% | -15% | +16% | +10%
That may be the different performance characters of generatorset vs.
filteredset. The "not draft()" query could be optimized in this case where
both "public" and "secret" are passed to "getrevsets" so it won't iterate
the whole repo twice.
syntax: glob
*.elc
*.tmp
*.orig
*.rej
*~
*.mergebackup
*.o
*.so
*.dll
*.exe
*.pyd
*.pyc
*.pyo
*$py.class
*.swp
*.prof
*.zip
\#*\#
.\#*
tests/.coverage*
tests/.testtimes*
tests/.hypothesis
tests/hypothesis-generated
tests/annotated
tests/*.err
tests/htmlcov
build
contrib/chg/chg
contrib/hgsh/hgsh
contrib/vagrant/.vagrant
contrib/docker/ubuntu-*
dist
packages
doc/common.txt
doc/*.[0-9]
doc/*.[0-9].txt
doc/*.[0-9].gendoc.txt
doc/*.[0-9].{x,ht}ml
MANIFEST
MANIFEST.in
patches
mercurial/__modulepolicy__.py
mercurial/__version__.py
mercurial/hgpythonlib.h
mercurial.egg-info
.DS_Store
tags
cscope.*
.idea/*
.asv/*
i18n/hg.pot
locale/*/LC_MESSAGES/hg.mo
hgext/__index__.py
# files installed with a local --pure build
mercurial/base85.py
mercurial/bdiff.py
mercurial/diffhelpers.py
mercurial/mpatch.py
mercurial/osutil.py
mercurial/parsers.py
syntax: regexp
^\.pc/
^\.(pydev)?project
# hackable windows distribution additions
^hg-python
^hg.py$