Explore: IO#timeout to get rid of BufferedIO
Opened this issue · 0 comments
byroot commented
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.