1
0
Fork 0
mirror of https://github.com/ruby/ruby.git synced 2022-11-09 12:17:21 -05:00

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

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