Backport #2741
Updated by jeremyevans0 (Jeremy Evans) over 5 years ago
=begin Reposting from a different bug report... # 10 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 writing the file takes 1s, reading it takes 2000s, as it reads (in windows) in only in 4K bytes, so it is constantly resizing the string and recopying it. In Linux it has the same problem, but reads in 64K bytes, so the problem is much less. =end