Mercurial > public > mercurial-scm > hg-stable
diff tests/test-parseindex2.py @ 16363:2cdd7e63211b
parsers: incrementally parse the revlog index in C
We only parse entries in a revlog index file when they are actually
needed, and cache them when first requested.
This makes a huge difference to performance on large revlogs when
accessing the tip revision or performing a handful of numeric lookups
(very common cases). For instance, "hg --time tip --template {node}"
on a tree with 300,000 revs takes 0.15 before, 0.02 after.
Even for revlog-intensive operations (e.g. running "hg log" to
completion), the lazy approach is about 1% faster than the eager
parse_index2.
author | Bryan O'Sullivan <bryano@fb.com> |
---|---|
date | Thu, 05 Apr 2012 13:00:35 -0700 |
parents | 5ef5eb1f3515 |
children | e8d37b78acfb |
line wrap: on
line diff
--- a/tests/test-parseindex2.py Wed Apr 04 00:00:47 2012 +0200 +++ b/tests/test-parseindex2.py Thu Apr 05 13:00:35 2012 -0700 @@ -52,7 +52,6 @@ return index, cache - data_inlined = '\x00\x01\x00\x01\x00\x00\x00\x00\x00\x00\x01\x8c' \ '\x00\x00\x04\x07\x00\x00\x00\x00\x00\x00\x15\x15\xff\xff\xff' \ '\xff\xff\xff\xff\xff\xebG\x97\xb7\x1fB\x04\xcf\x13V\x81\tw\x1b' \ @@ -94,13 +93,16 @@ '\xb6\r\x98B\xcb\x07\xbd`\x8f\x92\xd9\xc4\x84\xbdK\x00\x00\x00' \ '\x00\x00\x00\x00\x00\x00\x00\x00\x00' -def runtest() : +def parse_index2(data, inline): + index, chunkcache = parsers.parse_index2(data, inline) + return list(index), chunkcache +def runtest() : py_res_1 = py_parseindex(data_inlined, True) - c_res_1 = parsers.parse_index2(data_inlined, True) + c_res_1 = parse_index2(data_inlined, True) py_res_2 = py_parseindex(data_non_inlined, False) - c_res_2 = parsers.parse_index2(data_non_inlined, False) + c_res_2 = parse_index2(data_non_inlined, False) if py_res_1 != c_res_1: print "Parse index result (with inlined data) differs!"