Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Fetching contributors…

Cannot retrieve contributors at this time

24 lines (19 sloc) 0.399 kb
require 'benchmark'
MAX = 1000
BLOCKSIZE = 16 * 1024
LINES = 10000
FILE = 'io_test_bench_file.txt'
File.open(FILE, 'w'){ |fh|
LINES.times{ |n|
fh.puts "This is line: #{n}"
}
}
stat = File.stat(FILE)
(ARGV[0] || 5).to_i.times do
Benchmark.bm(30) do |x|
x.report('IO.foreach(file)'){
MAX.times{ IO.foreach(FILE){} }
}
end
end
File.delete(FILE) if File.exists?(FILE)
Jump to Line
Something went wrong with that request. Please try again.