diff options
| author | Aaron Patterson <tenderlove@ruby-lang.org> | 2025-09-13 07:34:53 +0900 |
|---|---|---|
| committer | Hiroshi SHIBATA <hsbt@ruby-lang.org> | 2025-09-16 17:17:32 +0900 |
| commit | 12aa9e7457458245c9452ca5f786f6191742edf2 (patch) | |
| tree | f2abd175b69f8c5316a28bab8827c178eeacc9bd /test/ruby/test_method_cache.rb | |
| parent | 6b0af3135264351d0bbaaf5cf6b207a9c84b6e76 (diff) | |
[rubygems/rubygems] Use `IO.copy_stream` with IO object directly
Before this patch we would use `IO.copy_stream` with the tar entry
object rather than just straight to the IO. That means every time
copy_stream wanted data, we would have to proxy the call.
The reason we did this is because every tar entry object _shares_ the
same IO object, and previous to https://github.com/rubygems/rubygems/commit/8927533b0a47
we would call `IO.copy_stream` _without_ a size. Without passing a
size, copy_stream will just read until there is nothing left to read, so
these proxy object emulate finding "the end of the file" (where "end of
file" means "end of tar chunk"). Without emulating this "end of file"
behavior, copy_stream would just keep reading past the end of the tar
chunk.
However, now that we're passing the size to copy_stream, we can bypass
the proxy object overhead and just use the IO object directly because
copy_stream knows exactly the number of bytes it needs to read and will
stop when it reaches the goal.
https://github.com/rubygems/rubygems/commit/857002c135
Diffstat (limited to 'test/ruby/test_method_cache.rb')
0 files changed, 0 insertions, 0 deletions
