Mercurial > hg
diff tests/test-contrib-perf.t @ 31721:be8a866a2c44
check-code: detect r.revision(r.node(rev))
revlog.revision takes either node or rev, but taking a rev is more
efficient, because converting rev to node is just a seek and read.
That's cheaper than converting node to rev, which may require O(n) walk in
revlog index for the first times, and then triggering building the radix
tree index. Even with the radix tree built, rev -> node is still faster than
node -> rev because the radix tree requires more jumps in memory.
So r.revision(r.node(rev)) should be changed to r.revision(rev). This patch
adds a check-code rule to detect that.
author | Jun Wu <quark@fb.com> |
---|---|
date | Wed, 29 Mar 2017 16:46:57 -0700 |
parents | 5a9e4dc8e4fd |
children | 0e4f70f63aaa |
line wrap: on
line diff
--- a/tests/test-contrib-perf.t Wed Mar 29 12:37:03 2017 -0700 +++ b/tests/test-contrib-perf.t Wed Mar 29 16:46:57 2017 -0700 @@ -165,3 +165,7 @@ $ (hg files -r 1.2 glob:mercurial/*.c glob:mercurial/*.py; > hg files -r tip glob:mercurial/*.c glob:mercurial/*.py) | > "$TESTDIR"/check-perf-code.py contrib/perf.py + contrib/perf.py:859: + > r.revision(r.node(x)) + don't covert rev to node before passing to revision(nodeorrev) + [1]