From: Christian Weisgerber Subject: Re: Optimized branch switching? To: gameoftrees@openbsd.org Date: Mon, 12 Sep 2022 22:45:05 +0200 Stefan Sperling: > > > $ 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 > > > > 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. Uh, it's about "update -b" not any "branch" command. But sure: $ time got branch -n foo 0m00.11s real 0m00.03s user 0m00.05s system > Just checking on a local machine here, a no-op update of /usr/ports > is much faster: Not here: $ time got up Already up-to-date 0m22.21s real 0m04.38s user 0m09.26s system It's a slow machine (APU2). So you're right, it's just the "got update" time. > Could you re-pack your repository and try again? $ gotadmin info repository: /home/naddy/ports.git pack files: 5 packed objects: 1750917 packed total size: 508M loose objects: 11 loose total size: 54.2K That doesn't actually look bad. But sure, one "git gc" later: $ gotadmin info repository: /home/naddy/ports.git pack files: 1 packed objects: 1750064 packed total size: 502M loose objects: 1 loose total size: 1.8K $ time got up Already up-to-date 0m23.35s real 0m05.33s user 0m09.69s system Yeah, that didn't make a difference. Looks like "got update" scales with the speed of the underlying hardware, which isn't that surprising. :-) -- Christian "naddy" Weisgerber naddy@mips.inka.de