[PATCH] revset: use "repo.changelog" instead of "list(repo)" for resource efficiency

FUJIWARA Katsunori foozy at lares.dti.ne.jp
Wed Feb 20 07:02:27 CST 2013


At Tue, 19 Feb 2013 10:27:40 -0800,
Bryan O'Sullivan wrote:
> 
> [1  <text/plain; UTF-8 (7bit)>]
> On Sun, Feb 17, 2013 at 8:08 AM, FUJIWARA Katsunori
> <foozy at lares.dti.ne.jp>wrote:
> 
> > This patch uses "repo.changelog" instead of "list(repo)" for resource
> > efficiency.
> >
> 
> What effect does this have on performance?

I expected this patch to prevent from immediate creation of "list"
object containing integers corresponded to all revisions in
repository, because it may be very large and not be used.

For example, "revset.stringset()" omits "x in subset" check, if
"len(subset) == len(repo)": "len(list(repo)) == len(repo)" is always
True, if there is no hidden revision.

But, I overlooked that:

  - changelog has "__iter__()" but not "__contains__()". it decreases
    performance, because each "x in cl" causes "__iter__()" invocation

  - some codes outside revset module also invoke "revset.getset()"
    with "list(repo)"

IMHO, "repo" itself seems to be good to take place of "list(repo)":
"repo" should have all of "__iter__()", "__len__()" and
"__contains_()".
    
I'll try to resend refined one.

----------------------------------------------------------------------
[FUJIWARA Katsunori]                             foozy at lares.dti.ne.jp


More information about the Mercurial-devel mailing list