Login  Register

Re: Faster JRuby execution

Posted by mojavelinux on Apr 15, 2013; 10:11pm
URL: https://discuss.asciidoctor.org/Faster-JRuby-execution-tp130p133.html

That's my plan. Alex, since it's related to the Java integration, I'd like to offer you the first shot at doing a blog post.

-Dan


On Mon, Apr 15, 2013 at 4:06 PM, lightguard.jp [via Asciidoctor :: Discussion] <[hidden email]> wrote:
This should go up on a blog post


On Mon, Apr 15, 2013 at 2:09 PM, mojavelinux [via Asciidoctor :: Discussion] <[hidden email]> wrote:
For small tasks, such as converting an AsciiDoc document, there are certain flags you can enable for JRuby and Java that make it startup much, much faster, esp when invoked via Java (like 3x as fast). The trade-off is that you are disabling optimizations that impact long-running processes, but...exactly, we don't need them.

Here's the set of flags I've worked out thus far:

-Djruby.compat.version=RUBY1_9 -Djruby.compile.mode=OFF -XX:+TieredCompilation -XX:TieredStopAtLevel=1 -Xverify:none

Here's an example of making a simple JRuby call without these flags:

time jruby -e 'puts "Hello, World!"'

real 0m1.170s
user 0m1.966s
sys 0m0.078s

Now I'll add these flags,

export JRUBY_OPTS="-Djruby.compat.version=RUBY1_9 -Djruby.compile.mode=OFF -XX:+TieredCompilation -XX:TieredStopAtLevel=1 -Xverify:none"

and call the same script again:

time jruby -e 'puts "Hello, World!"'

real 0m0.090s
user 0m0.070s
sys 0m0.021s

That certainly speeds things up.

Now, I'll execute the generate-resources goal in Maven to invoke the Asciidoctor Maven plugin, first without any flags:

real 0m7.361s
user 0m14.733s
sys 0m0.297s

Now I'll add the flags. The only way I can figure out to pass these flags to JRuby is to set them as Maven options:

real 0m3.310s
user 0m4.537s
sys 0m0.260s

Voila! I think that will certainly save a lot of waiting :)

If anyone knows:

a. Flags that can make it go even faster
b. How to pass flags to JRuby w/o having to apply them to Maven globally

please let us know!

-Dan

--
Dan Allen
Principal Software Engineer, Red Hat | Author of Seam in Action
Registered Linux User #231597




If you reply to this email, your message will be added to the discussion below:
http://discuss.asciidoctor.org/Faster-JRuby-execution-tp130.html
To start a new topic under Asciidoctor :: Discussion, email [hidden email]
To unsubscribe from Asciidoctor :: Discussion, click here.
NAML



--



If you reply to this email, your message will be added to the discussion below:
http://discuss.asciidoctor.org/Faster-JRuby-execution-tp130p131.html
To start a new topic under Asciidoctor :: Discussion, email [hidden email]
To unsubscribe from Asciidoctor :: Discussion, click here.
NAML



--
Dan Allen
Principal Software Engineer, Red Hat | Author of Seam in Action
Registered Linux User #231597

http://google.com/profiles/dan.j.allen
http://mojavelinux.com
http://mojavelinux.com/seaminaction