This makes it actually useful. In compared the time in my hg repo with
69.6k revisions and with a disambiguation revset of "not public()"
that matches 563 visible revisions. I ran "time hg log -T
'{shortest(node1,)}' -r 0:1000" (no revisions within the revset in
that revision range). Before this patch, it took 57s and after it took
0.7s.
Details
- Reviewers
- None
- Group Reviewers
hg-reviewers - Commits
- rHG3588e41f796d: shortest: cache disambiguation revset
Diff Detail
- Repository
- rHG Mercurial
- Lint
Lint Skipped - Unit
Unit Tests Skipped
Event Timeline
This doesn't seem like the right way to cache it. Suggestions?
Suppose the cache exists mainly for templating, templatefuncs.shortest()
can pass in a cached revset to resolvehexnodeidprefix(), and we don't have
to take care of cache invalidation.
If we want to cache a prefix tree, maybe it could be turned into a "resolver"
object which the templater creates at the first shortest() call.
Yep, it's pretty much only for templating, so that's a good suggestion. I'll start working on that. Thanks!
If we want to cache a prefix tree, maybe it could be turned into a "resolver"
object which the templater creates at the first shortest() call.
I have a stack of changes that make the nodetree struct a Python type that can be used for this. I might clean that up and send it another day. I'll try to follow your advice here then (I don't know what a resolver is yet, but I'll figure that out later).
I've added support for passing in a cache, so this is ready for review again, thanks.
(I don't know what a resolver is yet, but I'll figure that out later).
Perhaps I mistook a function name. I just meant shortesthexnodeidprefix()
could be turned into a closure having node cache.