Add IO write throughput/locking overhead benchmark.
This commit is contained in:
parent
15ebfe2849
commit
216593f59b
Notes:
git
2022-05-28 12:44:47 +09:00
|
@ -0,0 +1,22 @@
|
||||||
|
#!/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
|
Loading…
Reference in New Issue