ruby/benchmark/io_write.rb

Ignoring revisions in .git-blame-ignore-revs. Click here to bypass and see the normal blame view.

23 строки
239 B
Ruby
Исходник Обычный вид История

#!/usr/bin/env ruby
require 'benchmark'
i, o = IO.pipe
o.sync = true
DOT = ".".freeze
chunks = 100_000.times.collect{DOT}
thread = Thread.new do
while i.read(1024)
end
end
100.times do
o.write(*chunks)
end
o.close
thread.join