This project is closed and read-only.
Actions
Backport #2722
closedgets on a large file takes a very very long time
Backport #2722:
gets on a large file takes a very very long time
Status:
Closed
Assignee:
-
Description
=begin
This problem occurs on 1.8.6, 1.8.7 and 1.9.1 (all the versions I tested)
This simple script demonstrates the problem:
100 MB¶
n = 100 * 1000 * 1000
puts "writing"
File.open("foo", 'wb'){|f| f.write(" " * n) }
puts "reading"
File.open("foo", 'rb') do |io|
io.gets
end
This takes about 1911 seconds. Using a 10MB file completes in 19 seconds, instead of in 1/10th the time as you would imagine. Similarly a 1MB file completes in 0.18 seconds.
=end
Actions