tim-harding / neophyte

A WebGPU rendered Neovim GUI
MIT License
143 stars 3 forks source link

Strange issue with guicursor and CPU usage #19

Closed xorander00 closed 3 months ago

xorander00 commented 4 months ago

Recently found this project and I like it! My daily driver is FreeBSD and so I'm slowly working on porting Neovide over to it, but Skia is a major PITA. This compiled and worked fine first time around! :)

So there are a few conditions which seem to cause Neophyte to spike CPU to 100%...

Haven't had a chance to dig in yet, but figured I'd post here for any thoughts/tips/etc to diagnose this behavior.

Granted, my environment is a bit more esoteric, but the process spiking to 100% CPU is strange...

Any thoughts would be appreciated, thanks! :)

tim-harding commented 3 months ago

Thanks for investigating this. The note about guicursor is very helpful. I'll try and jump in to look at this issue soon, as I've had problems with Neophyte sapping battery life on my Mac and this might be part of the problem. To clarify, are you using the crates.io version or the latest from GitHub? I've made updates since the last release that addressed the most egregious runaway resource use, but there may be other problems I haven't found.

tim-harding commented 3 months ago

Ah, sorry about that! I unfortunately can't reproduce the issue you're seeing. I add some logging for animation and elapsed time of redraw events, as that seems like the most likely source of problems. Could you run from the latest commit with RUSTLOG="neophyte=debug" cargo run and post the output while reproducing the issue?

xorander00 commented 3 months ago

My bad, my previous comments were from another account. Deleted them. Will try with the latest commit here shortly and let you know.

xorander00 commented 3 months ago

Issue seems fixed as of 8a4fceb32c7b2923de29cf13ba5586ebd8197229. I can post the logs if you'd still like to see, but from my quick skim, everything seemed pretty normal.

Yesterday I ran it through truss to see what the syscalls looked like when the issue was happening and I saw that during the time when I wasn't on the workspace that had neophyte (i.e. window wasn't visible), the truss log during that time period was ONLY a flood of calls to kevent (part of kqueue on FreeBSD). Seemed like it was trying to unregister an event notification but got stuck in a loop (e.g. iterating over some list but had termination condition bug, or maybe thinking unregistering failed and kept retrying, etc).

I just ran it with truss again and the flood of kevent calls disappeared. Everything looked pretty normal in the log.

Anyway, seems to work now, so whatever changes you made fixed it. Thanks a bunch! :) Will see if I can contribute anything else down the line.

tim-harding commented 3 months ago

Sweet! It's possible there was a Winit bug that got fixed. I updated the crate versions as part of the recent commits. Glad to hear the issue is resolved.