-
Notifications
You must be signed in to change notification settings - Fork 122
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Reducing CPU usage #56
Comments
Oops, misclicked on mobile. Before making any action, it would be good to gather info and understand why kanata is somehow spending 30% of CPU resources. For me on version 1.0.5 in Windows, kanata usually stays at 0% and I've only seen it reach 0.2% occasionally. This is without doing any processor affinity changes. My initial guess is something problematic that we missed in the TCP code, but I'm unsure for now. I wouldn't want a user to have to mess around with configurations of number of processors to reduce CPU consumption; it should be at a good, low level by default. |
Okay the TCP server is probably exactly the root of this problem. 😅 I'll dig around in the code on my branch and try to figure this out. |
Yeah this was definitely the shoddy tcp incoming message handling code on my working branch. 😅 tl;dr I was wasting a lot of cycles trying to acquire mutex locks unnecessarily. I have fixed this now, CPU usage is back at a cool 0%. 😎 |
I have an AMD Ryzen 9 3900X 12-core processor, and when left running unchecked,
kanata
's CPU usage sits at 30%+.If I use Task Manager to restrict which processors
kanata.exe
can utilise, the CPU drops down to a negligible 0.x% without any noticeable performance impact (including with the TCP server emitting outgoing and processing incoming messages).I think it would be a good idea to allow the number of processors that kanata utilises to be configurable either via a command line flag or through the configuration file.
The text was updated successfully, but these errors were encountered: