Revset-based implementation of log command

Matt Mackall mpm at selenic.com
Thu Apr 12 15:49:14 CDT 2012


On Thu, 2012-04-12 at 21:52 +0200, Patrick Mézard wrote:
> Hello,
> 
> I have an implementation of log command using the revset work done for graphlog, passing the test suite, here:
> 
>   http://mezard.eu/hg/hg-does-it-look-good-for-you/
> 
> Most of the patches have been submitted for review, the remaining ones update log() to use the revset functions and add a simple benchmarking script. It executes a sequence of log queries on a repository using different hg versions, and measure the time to first line and total time. See below for runs on Mercurial and Mozilla repositories.
> 
> We can see that:
> 1- Globally, the revset version is at least marginally faster than the current one.
> 2- The exception is when we add or-ed predicates like "--user foo --user bar". The changelog is being read multiple times instead of once.
> 3- The revset version computes all revisions before displaying anything which explains the poor "first line" timings.
> 
> [2] could be fixed by cheating an creating a revset matching multiple predicated at once, like the prep() closure in commands.log().

Alternately, we could:

a) build a list of all changeset-examining predicates at parse-time
b) when we examine any changeset, fire all the changeset predicates and
cache the result

..but I'm not particularly concerned about this case. Usually we'll be
filtering with 'and' rather than 'or'.

> [3] could be fixed by turning revset.match() into a generator. It is
> not clear which revset functions can operate on a "subset" generator
> rather than a list but the simple ones like user() definitely can.
> Also, I have no idea how much overhead this will add compared to the
> list version.

Any predicate can choose to turn its args from generators into lists, if
need be, so it shouldn't be all that hard architecturally to get some of
this working.

-- 
Mathematics is the supreme nostalgia of our time.




More information about the Mercurial-devel mailing list