ruby/benchmark/io_file_read.rb

16 строки
172 B
Ruby

#
# Seek and Read file.
#
require 'tempfile'
max = 200_000
str = "Hello world! " * 1000
f = Tempfile.new('yarv-benchmark')
f.write str
max.times{
f.seek 0
f.read
}