Add IO write throughput/locking overhead benchmark.

This commit is contained in:
Samuel Williams 2022-01-09 19:46:42 +13:00
parent 15ebfe2849
commit 216593f59b
Notes: git 2022-05-28 12:44:47 +09:00
1 changed files with 22 additions and 0 deletions

22
benchmark/io_write.rb Normal file
View File

@ -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