A RetroSearch Logo

Home - News ( United States | United Kingdom | Italy | Germany ) - Football scores

Search Query:

Showing content from https://github.com/jruby/jruby/wiki/Using-Drip-with-JRuby below:

Using Drip with JRuby · jruby/jruby Wiki · GitHub

drip is a command-line tool that can be used to dramatically lower perceived JVM startup time. It does this by preloading an entirely new JVM process/instance in the background and allowing you to simply use the preloaded environment. This can improve startup of JRuby-based applications significantly.

Install drip if you haven't already (see https://github.com/ninjudd/drip)

You can check out drip directly and build it, or use Homebrew on OS X.

brew update && brew install drip

JRuby uses the JAVACMD environment variable (if present) as its executable (usually which java). drip uses the DRIP_INIT_CLASS environment variable to determine the main class to load. JRuby has a native Java class already setup for this purpose: org.jruby.main.DripMain.

export JAVACMD=`which drip`
export DRIP_INIT_CLASS=org.jruby.main.DripMain

On Drip versions earlier than 820f869 DRIP_INIT must be set.

Put any project-specific initialization code (Ruby code) in dripmain.rb in the current working directory. This file is automatically called by the special org.jruby.main.DripMain class when initializing the standby JVM process.

Rails Example:

# Rails project:
require_relative 'config/application'

# non-Rails Bundler-controlled project
require 'bundler/setup'
Bundler.require

If you would like to use drip automatically whenever you switch to JRuby with rvm, you will need to add a new hook file at $rvm_path/hooks/after_use_jruby_drip with the following content:

#!/usr/bin/env bash

if [[ "${rvm_ruby_string}" =~ "jruby" ]]
then
  export JAVACMD=`which drip`
  export DRIP_INIT_CLASS=org.jruby.main.DripMain
  
  # settings from: https://github.com/jruby/jruby/wiki/Improving-startup-time
  export JRUBY_OPTS="-J-XX:+TieredCompilation -J-XX:TieredStopAtLevel=1 -J-noverify" 
fi

Then you'll need to make that file executable:

chmod +x $rvm_path/hooks/after_use_jruby_drip

See also:


RetroSearch is an open source project built by @garambo | Open a GitHub Issue

Search and Browse the WWW like it's 1997 | Search results from DuckDuckGo

HTML: 3.2 | Encoding: UTF-8 | Version: 0.7.4