Skip to content
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

Implement buffered output to Reline::ANSI #790

Merged
merged 1 commit into from
Dec 2, 2024

Conversation

tompng
Copy link
Member

@tompng tompng commented Dec 2, 2024

Rendering gets slow after you enter Thread.new{loop{}} to IRB.
Every STDOUT.write call seems to pass execution to the cpu bound thread, making rendering slow.
Minimizing the number of STDOUT.write call will improve it.

Before
https://github.com/user-attachments/assets/b34dd1f2-bb79-4373-88d5-353fda2fe3bf

After
https://github.com/user-attachments/assets/a33f2e01-2591-4d45-84f5-6f43d1a067da

While trying Thread.new{loop{}}, be careful not to press TAB key. Loading RDoc document will hang up.

Minimize the call of STDOUT.write
This will improve rendering performance especially when there is a busy thread `Thread.new{loop{}}`
Copy link
Member

@ima1zumi ima1zumi left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM!

@ima1zumi ima1zumi merged commit a6fe45f into ruby:master Dec 2, 2024
40 checks passed
matzbot pushed a commit to ruby/ruby that referenced this pull request Dec 2, 2024
(ruby/reline#790)

Minimize the call of STDOUT.write
This will improve rendering performance especially when there is a busy thread `Thread.new{loop{}}`

ruby/reline@a6fe45f5ba
@tompng tompng deleted the stdout_buffering branch December 2, 2024 17:05
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Development

Successfully merging this pull request may close these issues.

2 participants