summaryrefslogtreecommitdiff
path: root/benchmark/io_write.rb
diff options
context:
space:
mode:
Diffstat (limited to 'benchmark/io_write.rb')
-rw-r--r--benchmark/io_write.rb22
1 files changed, 22 insertions, 0 deletions
diff --git a/benchmark/io_write.rb b/benchmark/io_write.rb
new file mode 100644
index 0000000000..cdb409948b
--- /dev/null
+++ b/benchmark/io_write.rb
@@ -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