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

From:
Stefan Sperling <stsp@stsp.name>
Subject:
gotwebd diff is too slow
To:
gameoftrees@openbsd.org
Date:
Tue, 13 Jun 2023 10:34:21 +0200

Download raw body.

Thread
I noticed that gothub.org is insanely slow when browsing diffs in src.git,
in the order of minutes (GET request taking 96897ms and similar according
to firefox dev tools).

Initially I thought this was due to gothub running in a slow arm64 VM.
But I can reproduce the same slowness on amd64 bare metal. Compare the
speed at which tog loads a diff to the speed of gotwebd running on the
same machine, and cry...

The hack below makes it much faster.
It seems the limit parameter to got_get_repo_commits() is not being respected?

I don't really understand why all this complicated hunting through commit
history is even necessary for displaying a diff to the first parent commit.
Can someone who understands this code come up with a better fix?

diff /home/stsp/src/got
commit - c6119c6d1145977d2ae8fb6754a9c369731d8dec
path + /home/stsp/src/got
blob - 3e66b1cc2a7cd11d9c5f6e4d07a2826a420824e2
file + gotwebd/got_operations.c
--- gotwebd/got_operations.c
+++ gotwebd/got_operations.c
@@ -431,6 +431,8 @@ got_get_repo_commits(struct request *c, int limit)
 			}
 		}
 		if (error || (limit && --limit == 0)) {
+			if (qs->action == DIFF)
+				break;
 			if (qs->file != NULL && *qs->file != '\0')
 				if (chk_multi == 0)
 					break;