I've poked around logging a bit, and here is what I discovered.

Writing to a File instance in JRuby is actually not too bad, until you
set sync = true on that instance. With that, MRI writes 7 times slower
(which is still fast enough), but JRuby does it 1000 times slower.

In the examples below, msg = 'blah' * 20

*MRI*

irb(main):014:0> f = open('/tmp/foo', (File::WRONLY | File::APPEND))
=> #<File:/tmp/foo>
irb(main):015:0> time { 1000.times { f.write msg }}
-0.001292 sec
=> nil
irb(main):016:0> f.sync = true
=> true
irb(main):017:0> time { 1000.times { f.write msg }}
-0.007927 sec
=> nil

*JRuby trunk *

irb(main):050:0> f = open('/tmp/foo', (File::WRONLY | File::APPEND))
=> #<File:/tmp/foo>
irb(main):051:0> time { 1000.times { f.write msg }}
-0.0020 sec
=> nil
irb(main):052:0> f.sync = true
=> true
irb(main):053:0> time { 1000.times { f.write msg }}
-1.809 sec
=> nil


-- 
Alexey Verkhovsky
CruiseControl.rb [http://cruisecontrolrb.thoughtworks.com]
RubyWorks [http://rubyworks.thoughtworks.com]

---------------------------------------------------------------------
To unsubscribe from this list please visit:

    http://xircles.codehaus.org/manage_email

Reply via email to