Improve IO read performance on Windows --------------------------------------
Key: JRUBY-2610 URL: http://jira.codehaus.org/browse/JRUBY-2610 Project: JRuby Issue Type: Wish Components: Core Classes/Modules Affects Versions: JRuby 1.1.1 Environment: Windows XP Pro, JRuby 1.1.2, Java 1.5 Reporter: Daniel Berger Using MRI: {noformat} user system total real IO.foreach(file) 19.344000 3.235000 22.579000 ( 22.972000) IO.read(file) 1.344000 2.469000 3.813000 ( 3.922000) IO.read(file, 100) 0.359000 1.890000 2.249000 ( 2.548000) IO.read(file, 100, 20) 0.453000 1.813000 2.266000 ( 2.531000) {noformat} Using JRuby: {noformat} user system total real IO.foreach(file) 59.619000 0.000000 59.619000 ( 59.605385) IO.read(file) 7.189000 0.000000 7.189000 ( 7.188646) IO.read(file, 100) 5.907000 0.000000 5.907000 ( 5.902518) IO.read(file, 100, 20) 5.610000 0.000000 5.610000 ( 5.610618) {noformat} Here's the benchmark source I used: {noformat} require 'benchmark' MAX = 10000 FILE = 'io_test_bench_file.txt' File.open(FILE, 'w'){ |fh| 1000.times{ |n| fh.puts "This is line: #{n}" } } Benchmark.bm(30) do |x| # Class Methods x.report('IO.foreach(file)'){ MAX.times{ IO.foreach(FILE){} } } x.report('IO.read(file)'){ MAX.times{ IO.read(FILE) } } x.report('IO.read(file, 100)'){ MAX.times{ IO.read(FILE, 100) } } x.report('IO.read(file, 100, 20)'){ MAX.times{ IO.read(FILE, 100, 20) } } end File.delete(FILE) if File.exists?(FILE) {noformat} -- This message is automatically generated by JIRA. - If you think it was sent incorrectly contact one of the administrators: http://jira.codehaus.org/secure/Administrators.jspa - For more information on JIRA, see: http://www.atlassian.com/software/jira --------------------------------------------------------------------- To unsubscribe from this list, please visit: http://xircles.codehaus.org/manage_email