monotone-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [Monotone-devel] speed of "mtn ls branches"


From: Zack Weinberg
Subject: Re: [Monotone-devel] speed of "mtn ls branches"
Date: Thu, 17 Jan 2008 16:59:05 -0500

On Jan 17, 2008 4:23 PM, William Uther
<address@hidden> wrote:
> On 18/01/2008, at 4:15 AM, Zack Weinberg wrote:
> > update.cc, function calculate_update_set:
> >
> > ...
> >   bool have_non_suspended_rev = false;
> >
> >   for (set<revision_id>::const_iterator it = candidates.begin(); it !=
> > candidates.end(); it++)
> >     {
> >       if (!app.get_project().revision_is_suspended_in_branch(*it,
> > branch))
> >         {
> >           have_non_suspended_rev = true;
> >           break;
> >         }
> >     }
> >   if (!app.opts.ignore_suspend_certs && have_non_suspended_rev)
> >     {
> >       // remove all suspended revisions
> >       base64<cert_value> branch_encoded;
> >       encode_base64(cert_value(branch()), branch_encoded);
> >       suspended_in_branch s(app, branch_encoded);
> >       for(std::set<revision_id>::iterator it = candidates.begin(); it
> > != candidates.end(); it++)
> >         if (s(*it))
> >           candidates.erase(*it);
> >     }
>
> Yes, that is repeating some work.  Here is the intention:
>
>    If there are any non-suspended update candidates then remove the
> suspended
>    update candidates, otherwise leave all the suspended revs in the
> candidate
>    set.

Couldn't you do that like this?  (note: the code under discussion is
the last thing in the function, and "candidates" is its out-argument).

    if (app.opts.ignore_suspend_certs)
      return;

    set<revision_id> active_candidates;
    for (set<revision_id>::const_iterator i = candidates.begin();
         i != candidates.end(); i++)
      if (!app.get_project().revision_is_suspended_in_branch(*i, branch))
        active_candidates.push_back(*i);

    if (!active_candidates.empty())
      {
        // maybe we could just do "candidates = active_candidates;" here?
        candidates.clear();
        std::copy(active_candidates.begin(), active_candidates.end(),
                  candidates);
      }

> How large are the candidate update sets?
> How slow are cert checks?

I don't know about the update sets, but checking certs involves
cryptography, which is slow.

zw




reply via email to

[Prev in Thread] Current Thread [Next in Thread]