Page MenuHomePhabricator

[POC] revset: on-disk cache for children queries
Needs ReviewPublic

Authored by joerg.sonnenberger on Apr 16 2019, 6:43 PM.

Details

Reviewers
None
Group Reviewers
hg-reviewers
Summary

This is a proof of concept for further discussion.

Diff Detail

Repository
rHG Mercurial
Lint
Lint Skipped
Unit
Unit Tests Skipped

Event Timeline

joerg.sonnenberger retitled this revision from revset: on-disk cache for children queries to [POC] revset: on-disk cache for children queries.Apr 16 2019, 6:49 PM

Do you have performance numbers to share? Substantial wins would definitely pique my interest :)

For the NetBSD repository, a trivial test with the new cache:

time hg log -r '1000~-400' -T {node} > /dev/null
real	0m1.898s
time hg log -r '1000~-400' -T {node} > /dev/null
real	0m0.170s
time hg log -r '1000~-1' -T {node} > /dev/null
real	0m0.166s
time hg log -r '440000~-1' -T {node} > /dev/null
real	0m0.170s

First one includes the time to initially warmup the cache.

Without the cache:

time hg log -r '1000~0' -T {node} > /dev/null
real	0m0.196s
time hg log -r '1000~-1' -T {node} > /dev/null
real	0m0.825s
time hg log -r '1000~-2' -T {node} > /dev/null
real	0m1.288s
time hg log -r '1000~-400' -T {node} > /dev/null
real	3m23.201s
time hg log -r '440000~-1' -T {node} > /dev/null
real	0m0.182s

In other words, building the cache is amortised by one or two queries for children early up in the tree. The cache still provides a good benefit nearer to tip.

Perhaps we'd want this to not be specifically for revsets? We could also write to it when we write to the changelog to keep it up to date.