Details
-
Type:
Bug
-
Status:
Closed
-
Priority:
Major
-
Resolution: Fixed
-
Affects Version/s: JRuby 1.1RC2
-
Fix Version/s: JRuby 1.1.3
-
Component/s: Performance
-
Labels:None
-
Environment:JRuby 1.1RC2
-
Number of attachments :
Description
The following script is very slow in JRuby compared to MRI:
http://pastie.org/162908
file = "100k.rb" # 100k lines file
# create data file, if it doesn't exist yet
unless (File.exists?(file))
File.open(file, "w+") { |f|
f.puts("a = 1")
100000.times { f.puts("a += 1") }
f.puts("p a")
}
end
if defined?(JRUBY_VERSION)
exec("jruby.bat -X-C #{file}")
else
exec("ruby #{file}")
end
# MRI is 0.3 sec
# JRuby, depending on the mode, 20 - 45 secs!!!
First, the bufferization to script file reading was added in rev. r6140, and modified "ListNode to use an ArrayList, to avoid the constant arraycopy when adding many nodes" in rev r6146 by headius.
For me, the run time is down to 7 secs from 30-45 secs, so I consider this result to be OK, given this is a very pathological case.