Skip to content

perf: Throttle message handling to reduce CPU load#1700

Open
g2mt wants to merge 2 commits into
charmbracelet:mainfrom
g2mt:rendererRequest
Open

perf: Throttle message handling to reduce CPU load#1700
g2mt wants to merge 2 commits into
charmbracelet:mainfrom
g2mt:rendererRequest

Conversation

@g2mt
Copy link
Copy Markdown

@g2mt g2mt commented May 14, 2026

This PR throttles the amount of messages handled by the event loop such that processing can occur in a maximum of one frame tick.

In the latest crush version (v0.67), whenever crush displays the loading animation or shows the tokens generated by a request, it always takes up one entire CPU core doing so. I was able to reduce the CPU load down to a maximum of around 3% with this patch.

@g2mt g2mt marked this pull request as draft May 15, 2026 17:53
@g2mt g2mt marked this pull request as ready for review May 15, 2026 17:59
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant