ruby/benchmark/bm_io_file_read.rb

16 строки
171 B
Ruby

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