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

Explore: IO#timeout to get rid of BufferedIO #142

Open
byroot opened this issue Sep 30, 2023 · 0 comments
Open

Explore: IO#timeout to get rid of BufferedIO #142

byroot opened this issue Sep 30, 2023 · 0 comments

Comments

@byroot
Copy link
Member

byroot commented Sep 30, 2023

The whole point of BufferedIO is to be able to perform IO#gets with a timeout. But it requires to copy and slices lots of strings, even though Ruby IOs already have an internal buffer.

Ruby 3.2 introduced IO#timeout, and it applies to gets among other. If it works properly we might be able to get rid of this second layer of buffering in 3.2+.

Things to check:

  • gets
  • getbyte
  • SSLSocket?

If it does work, some other gems may benefit from it, e.g. Net::HTTP etc.

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

No branches or pull requests

1 participant