Hi all,

At Ola's request I've been trying to figure out why RDoc performance
is as bad as it is. Well, I don't see any cheap wins there, but here
are some observations:

1. RDoc is doing a ton of low-level byte pushing. Consider
RDoc::RubyParser#get_tk at rdoc/parsers/parse_rb.rb:1465 (which is
where RDoc spends the bulk of its CPU time at the parsing stage). Many
of these low-level operations are several times slower in JRuby, until
you turn on JIT compiler.

2. Many methods invoked under get_tk are not JIT-compiled because of
optional or "rest" (*args) arguments.

3. At this level of granularity, profiling is not accurate enough to
pinpoint an actual bottleneck, even if there is one. I don't, by the
way, think that there is - whichever way I profiled it, CPU time is
spread across multiple very low-level methods.

One thing that does take much time is DefaultMethod.prepareOptOrRestArgs().

Consider this code:

--------------------------------
def foo(*args) end

start = Time.now
1000000.times { foo }
finish = Time.now
puts "Elapsed time: #{finish - start}"
--------------------------------

It prints out the following:

Ruby
Elapsed time: 0.460686

JRuby
Elapsed time: 2.536

JRuby with DefaultMethod#prepareOptOrRestArgs() stubbed out:
Elapsed time: 0.865

JRuby with (*args) removed from script (enabling JIT compilation of foo)
Elapsed time: 0.632

I will continue playing with this stuff and post my findings in this
thread. Any ideas/feedback are appreciated.

--
Alex Verkhovsky

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

   http://xircles.codehaus.org/manage_email

Reply via email to