Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Use JRuby's DripMain plus a better init for booting JRuby. #73

Merged
merged 1 commit into from
Dec 30, 2013

Conversation

headius
Copy link
Collaborator

@headius headius commented Dec 24, 2013

This commit changes two things when Drip is used to run JRuby:

  • DRIP_INIT_CLASS now uses org.jruby.main.DripMain

DripMain has been available in JRuby since 1.7.0 was released over
a year ago, and does extra prebooting to prepare a JRuby instance
and to optionally load dripmain.rb in the current directory. With
these combined changes, JRuby commands can be reduced from seconds
to tenths of a second, even for complex commands that must boot
frameworks like Raile.

  • DRIP_INIT provides more useful code for warming the instance.

Rather than simple evaluating "nil", we instead use "1 + 1" which
forces more classes to boot and dynamic call mechanisms to fire.
The DRIP_INIT arguments are not used in currently-released
versions of JRuby, but currently-released versions of JRuby use
the "1 + 1" boot by default.

It is my understanding that if org.jruby.main.DripMain is not
present, the default behavior is falling back on Drip's own main,
so at worst this will have no impact on older versions of JRuby
used with Drip. It's also worth pointing out that the old class --
org.jruby.main -- does not exist, so current versions of Drip were
not actually prebooting JRuby at all. The correct class would have
been org.jruby.Main.

This commit changes two things when Drip is used to run JRuby:

* DRIP_INIT_CLASS now uses org.jruby.main.DripMain

DripMain has been available in JRuby since 1.7.0 was released over
a year ago, and does extra prebooting to prepare a JRuby instance
and to optionally load dripmain.rb in the current directory. With
these combined changes, JRuby commands can be reduced from seconds
to tenths of a second, even for complex commands that must boot
frameworks like Raile.

* DRIP_INIT provides more useful code for warming the instance.

Rather than simple evaluating "nil", we instead use "1 + 1" which
forces more classes to boot and dynamic call mechanisms to fire.
The DRIP_INIT arguments are not used in currently-released
versions of JRuby, but currently-released versions of JRuby use
the "1 + 1" boot by default.

It is my understanding that if org.jruby.main.DripMain is not
present, the default behavior is falling back on Drip's own main,
so at worst this will have no impact on older versions of JRuby
used with Drip. It's also worth pointing out that the old class --
org.jruby.main -- does not exist, so current versions of Drip were
not actually prebooting JRuby at all. The correct class would have
been org.jruby.Main.
@swistaczek
Copy link

👍

ninjudd added a commit that referenced this pull request Dec 30, 2013
Use JRuby's DripMain plus a better init for booting JRuby.
@ninjudd ninjudd merged commit 2fad28d into ninjudd:master Dec 30, 2013
@ninjudd
Copy link
Owner

ninjudd commented Dec 30, 2013

Thanks @headius!

@headius headius deleted the better_jruby branch January 11, 2014 21:43
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants