[PATCH 5 of 6 v6] localrepo: convert _updatebranchcache from nodespace to revspace
Bryan O'Sullivan
bos at serpentine.com
Thu Jun 14 18:33:50 CDT 2012
On Fri, Jun 8, 2012 at 2:27 PM, Joshua Redstone <joshua.redstone at fb.com>wrote:
>
> This also fixes a small performance bug. The function would iterate over
> new
> candidate heads in order from oldest to newest, in contrast to the comment
> that
> observes that iterating from newest to oldest results in fewer pases over
> the
> set of reachable nodes.
>
Are you sure? It looks to me like the old behaviour did what it claimed to,
and that you've reversed its behaviour.
- bheads = sorted(bheads, key=lambda x: self[x].rev())
>
This is where the old code sorts the nodes in rev order. Here, tip will be
at the end of the list, because it's the rev with the highest number.
> + bheadrevs.sort()
>
Here, you preserve this sort order.
> - while newnodes:
> - latest = newnodes.pop()
>
This is where the old code pulls the tipmost rev off the list - by removing
its last (highest) element.
> + newrevs.sort(reverse=True)
> + while newrevs:
> + latest = newrevs.pop()
>
I believe that here, you are reversing the list so that tip is at the
beginning, then by use of pop, you pull off the rev that's *furthest* from
tip.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://selenic.com/pipermail/mercurial-devel/attachments/20120614/ba559a99/attachment.html>
More information about the Mercurial-devel
mailing list