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

From:
Stefan Sperling <stsp@stsp.name>
Subject:
Re: tog: 100% cpu usage after search in full-screen mode
To:
Mikhail <mp39590@gmail.com>
Cc:
Mark Jamsek <mark@jamsek.com>, gameoftrees@openbsd.org
Date:
Wed, 8 Feb 2023 21:36:09 +0100

Download raw body.

Thread
On Wed, Feb 08, 2023 at 09:48:46PM +0300, Mikhail wrote:
> On Wed, Feb 08, 2023 at 05:57:00PM +1100, Mark Jamsek wrote:
> > On 23-02-07 09:23PM, Mikhail wrote:
> > > 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.
> > 
> > Nice find! Thanks, Mikhail :)
> > 
> > This is indeed a weird one! I think it's because we unset our 1s refresh
> > rate when entering view_search_start(), and because fast_refresh is now
> > 0, we never meet that condition in view_input() to reset it back to 1s
> > again.
> > 
> > Whereas if we follow the recipe without waiting 10s, fast_refresh will
> > still be > 0 thus the 1s refresh rate will still be set in view_input().
> > 
> > > 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:
> > 
> > While the diff does indeed fix the problem, I don't think we want to
> > call halfdelay() every iteration. We could make it a global, but it's
> > only used in now two locations, so let's pass it as an argument instead.
> 
> Yeah, fixes things for me, thank you.

Great, ok from me. And thanks for reporting this issue Mikhail.