Skip to content

Instantly share code, notes, and snippets.

@methodmissing
Created July 26, 2009 19:29
Show Gist options
  • Select an option

  • Save methodmissing/155898 to your computer and use it in GitHub Desktop.

Select an option

Save methodmissing/155898 to your computer and use it in GitHub Desktop.
def test_read_multi_non_blocking
cbs = fixtures( *%w(1.txt 2.txt 3.txt 4.txt) ).map{|f| AIO::CB.new(f) }
assert_equal nil, AIO.lio_listio( *([AIO::NOWAIT].concat(cbs)) )
sleep(1)
assert_equal %w(one two three four), cbs.map{|cb| cb.buf }
end
macbook-pros-computer:rb_aio_native lourens$ rake bench
(in /Users/lourens/projects/rb_aio_native)
user system total real
AIO.lio_listio(AIO::WAIT) 0.000000 0.000000 0.000000 ( 0.000105)
IO.read 0.000000 0.000000 0.000000 ( 0.000375)
user system total real
AIO.lio_listio(AIO::NOWAIT) 0.000000 0.000000 0.000000 ( 0.000044)
IO.read 0.000000 0.000000 0.000000 ( 0.000361)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment