repo.or.cz
/
ruby.git
/
blob
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
log
|
graphiclog1
|
graphiclog2
|
commit
|
commitdiff
|
tree
|
refs
|
edit
|
fork
history
|
raw
|
HEAD
[rubygems/rubygems] Use a constant empty tar header to avoid extra allocations
[ruby.git]
/
benchmark
/
io_pipe_rw.rb
blob
6862a8ae61ebe98bf21673ff31a9e9b80bb597cf
1
# Measure uncontended GVL performance via read/write with 1:1 threading
2
# If we switch to M:N threading, this will benchmark something else...
3
r, w = IO.pipe
4
src = '0'.freeze
5
dst = String.new
6
i = 0
7
while i < 1_000_000
8
i += 1
9
w.write(src)
10
r.read(1, dst)
11
end
12
w.close
13
r.close