Details
-
Type:
Bug
-
Status:
Closed
-
Priority:
Major
-
Resolution: Fixed
-
Affects Version/s: JRuby 1.4
-
Fix Version/s: JRuby 1.5
-
Component/s: Performance
-
Labels:None
-
Number of attachments :
Description
Through analysis of JRUBY-2810 I found that RubyIO#incrementLineno is indirectly invoked by all line-retrieving methods in RubyIO, including RubyIO#foreach and RubyIO#each_line. On large files this shows up as the largest offender in profiles, consuming nearly 40% of the total execution time.
It isn't clear through initial analysis why it is there, but if it is required, a more optimal path should be considered to improve large file scanning performance.
Please see http://gist.github.com/213949 for timings with and without incrementLineno. (Please note that these timings were all captured using the modified 'bench_io_foreach.rb' from the patch proposed on JRUBY-2810 - please use that version to do comparisons, as it has very difference characteristics than the current version in master).
Issue Links
| This issue is depended upon by: | ||||
| JRUBY-2810 | IO foreach performance is slower than MRI |
|
|
|
I made several improvements in 1bd4ca2, which seems to have reduced the overall cost of the line number updates substantially. I have also posted a question to ruby-core asking for clarification about why $. and $< seem to be intertwined for no apparently good reason. We'll leave this open until they get back to me.