Change clindex so it can use the rust nodemap for node lookups and partial
match. By default, the code runs in a "verify" mode that compares the rust
nodemap against the original nodemap. Once we gain more confident, we can
drop the support of the original nodemap (so it does not build a radix
tree).
After this, there is no need to enable perftweaks.cachenoderevs or
fastpartialmatch.
Performance wise, the nodemap seems to be a bit faster than revlog.c trie.
The former takes 91% (+/-5%) of the time needed for the latter. That was
tested by running the following script 20 times on fbsource:
from mercurial.cext import parsers
from hgext3rd.rust import indexes
import contextlib, os
m = {}
@contextlib.contextmanager
def measure(name):
utime, stime, cutime, cstime, elapsed = os.times()
try:
yield
finally:
utime2, stime2, cutime, cstime, elapsed2 = os.times()
print('%14s: User %.3f Sys %.3f Real %.3f'
% (name, utime2 - utime, stime2 - stime, elapsed2 - elapsed))
m[name] = elapsed2 - elapsed
cl = open('00changelog.i').read()
with measure('nodemap'):
nm = indexes.nodemap(cl, indexes.nodemap.emptyindexbuffer())
nm.partialmatch('da0443cd533f4073e8d0e324d55')
with measure('revlog index'):
idx = parsers.index(cl, False)
idx.partialmatch('da0443cd533f4073e8d0e324d55')
print('nodemap: %.2f revlog' % (m['nodemap'] / m['revlog index']))
And we're relying on the mmap config to make this fast right?