"GOT", but the "O" is a cute, smiling pufferfish. Index | Thread | Search

From:
Stefan Sperling <stsp@stsp.name>
Subject:
Re: Optimized branch switching?
To:
Christian Weisgerber <naddy@mips.inka.de>, gameoftrees@openbsd.org
Date:
Mon, 12 Sep 2022 10:38:36 +0200

Download raw body.

Thread
On Sun, Sep 11, 2022 at 10:59:08AM +0200, Stefan Sperling wrote:
> On Sat, Sep 10, 2022 at 10:39:47PM +0200, Christian Weisgerber wrote:
> > Look at this:
> > 
> > $ got br
> > local
> > $ got log -l1
> > -----------------------------------------------
> > commit ec5b7def698dac3e452acf7d56900e891c0f47e7 (local, master, origin/master)
> > from: ajacoutot <ajacoutot@openbsd.org>
> > date: Sat Sep 10 17:40:52 2022 UTC
> >  
> >  Update to awscli-1.25.71.
> >  
> > $ time got up -b master
> > Switching work tree from refs/heads/local to refs/heads/master
> > Already up-to-date
> >     0m21.18s real     0m04.48s user     0m09.00s system
> > 
> > Given that the tip of the branch we're switching from is identical
> > to the one we're switching to, shouldn't this be faster?  Like,
> > almost a nop?
> 
> Try measuring again with 'got branch -n'.
> I suspect the time is spent by the equivalent of 'got update', since
> 'got branch' implicitly updates the work tree.
> 
> If time is indeed spent on updating the work tree, then we would need
> to figure out whether we can speed up the 'got update' code path.

Just checking on a local machine here, a no-op update of /usr/ports
is much faster:

$ time got up
Already up-to-date
    0m02.66s real     0m00.74s user     0m01.26s system
$

Could you re-pack your repository and try again?