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

From:
Mikhail <mp39590@gmail.com>
Subject:
tog: 100% cpu usage after search in full-screen mode
To:
gameoftrees@openbsd.org
Date:
Tue, 7 Feb 2023 21:23:22 +0300

Download raw body.

Thread
I spent a little bit time on this, but wasn't able to get a clue:

run tog in got repo
wait 10 secs
<enter>
F
/whatever

look in 'top' how tog slowly starts eating whole CPU.

I dug it to view_loop, which starts cycling like crazy. Pressing 'q'
while in full-screen cpu-eating mode makes tog back to normal cpu usage.

Inlined patch fixes the issue for me, but it's "monkey see - monkey do"
kind of patch, can't propose it like a solution:

diff /home/misha/work/got
commit - 704b1cf77bf5aa6f9aeed7bca0b34c53cc2183c2
path + /home/misha/work/got
blob - a6351da680ffacc2f47bf1a42b494d77af0b4a3a
file + tog/tog.c
--- tog/tog.c
+++ tog/tog.c
@@ -1747,7 +1747,6 @@ view_loop(struct tog_view *view)
 	struct tog_view_list_head views;
 	struct tog_view *new_view;
 	char *mode;
-	int fast_refresh = 10;
 	int done = 0, errcode;
 
 	mode = getenv("TOG_VIEW_SPLIT_MODE");
@@ -1771,9 +1770,7 @@ view_loop(struct tog_view *view)
 	doupdate();
 	while (!TAILQ_EMPTY(&views) && !done && !tog_thread_error &&
 	    !tog_fatal_signal_received()) {
-		/* Refresh fast during initialization, then become slower. */
-		if (fast_refresh && --fast_refresh == 0)
-			halfdelay(10); /* switch to once per second */
+		halfdelay(10);
 
 		err = view_input(&new_view, &done, view, &views);
 		if (err)