One of the ideas we have had to improve startup perf is to lazily load all the generated invoker classes, rather than eagerly loading them whether you're going to call those methods or not. I've just done a spike of this, and while it helps a bit it doesn't improve things a whole lot.
Here's the count of classes loaded for "puts 1" along with timings for
startup on master:
~/projects/jruby ➔ jruby -J-verbose:class -e "puts 1" | wc
2661 11583 268681
~/projects/jruby ➔ time jruby -e "puts 1"
1
real 0m0.584s
user 0m0.452s
sys 0m0.092s
Here's with my patch that makes all invokers be lazily constructed.
You can see that we load far fewer classes (almost 1000 fewer) but the
raw startup perf improves only by about 8-10%:
~/projects/jruby ➔ jruby -J-verbose:class -e "puts 1" | wc
1732 7867 162740
~/projects/jruby ➔ time jruby -e "puts 1"
1
real 0m0.532s
user 0m0.398s
sys 0m0.079s
This also appears to have only a small impact on RubyGems startup
(about the same amount of time trimmed off as for "puts 1"), which is
the real perf killer for most applications:
BEFORE:
~/projects/jruby ➔ time jruby -rubygems -e "puts 1"
1
real 0m2.442s
user 0m2.159s
sys 0m0.192s
AFTER:
~/projects/jruby ➔ time jruby -rubygems -e "puts 1"
1
real 0m2.395s
user 0m2.094s
sys 0m0.182s
I've attached the patch if anyone else wants to poke around on it. For
now, it doesn't appear to solve startup issues *enough* to be worth
it, but I'm willing to entertain suggestions.
Oh, and Tom: I quickly figured out that in the initial boot we are
*not* calling invalidateDescendants, so those calls you saw in the
profile are entirely from post-init class construction.
- Charlie
0001-Make-all-generated-invoker-objects-lazily-constructe.patch
Description: Binary data
---------------------------------------------------------------------
To unsubscribe from this list, please visit:
http://xircles.codehaus.org/manage_email
