Skip to content

perf: replace polling loop with event-driven waiting for process output - #9

Closed
Danthewaann wants to merge 7 commits into
mainfrom
improve-output-rendering-speed
Closed

Danthewaann wants to merge 7 commits into
mainfrom
improve-output-rendering-speed

Conversation

@Danthewaann

Copy link
Copy Markdown
Owner

Replace the fixed time.sleep(0.1) in the main render loop with an event-driven wait using selectors. Each process's stdout file descriptor is registered with a selector, and the main loop blocks in select() until either new output is ready to read or a short timeout elapses, instead of redrawing on a fixed interval regardless of whether anything changed.

Process output is now read directly on the main thread instead of via a background reader thread per process, since the selector already tells us when there's data available. When a process exits, any output still sitting in its pipe is drained immediately so trailing output written right before exit isn't missed.

Also update the progress spinner so it's update interval is tied to the elapsed time for each process. This means it can still render at a consistent interval since the time.sleep(0.1) call is gone, which previously gated when it got updated.

@Danthewaann Danthewaann self-assigned this Aug 10, 2026
@Danthewaann
Danthewaann force-pushed the improve-output-rendering-speed branch 6 times, most recently from fd81f01 to f4ae4d8 Compare August 10, 2026 09:10
@Danthewaann
Danthewaann force-pushed the improve-output-rendering-speed branch from f4ae4d8 to 926a479 Compare August 10, 2026 09:11
@Danthewaann
Danthewaann force-pushed the improve-output-rendering-speed branch from 2497a18 to 6c1d402 Compare August 10, 2026 10:14
@Danthewaann
Danthewaann force-pushed the improve-output-rendering-speed branch 2 times, most recently from a9b388d to 996ceb6 Compare August 11, 2026 16:01
@Danthewaann
Danthewaann force-pushed the improve-output-rendering-speed branch from 996ceb6 to bbccc4f Compare August 11, 2026 16:07
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