Skip to content

Instantly share code, notes, and snippets.

@headius
Created November 27, 2012 19:20
Show Gist options
  • Star 4 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save headius/4156388 to your computer and use it in GitHub Desktop.
Save headius/4156388 to your computer and use it in GitHub Desktop.
Drip experiments in JRuby
# BASELINE STARTUP TIMES WITHOUT DRIP
system ~/projects/jruby $ jruby -v
jruby 1.7.1.dev (1.9.3p327) 2012-11-26 810defe on Java HotSpot(TM) 64-Bit Server VM 1.7.0_09-b05 [darwin-x86_64]
system ~/projects/jruby $ time jruby -e 1
real 0m1.238s
user 0m1.985s
sys 0m0.091s
system ~/projects/jruby $ time jruby -e 1
real 0m1.237s
user 0m2.005s
sys 0m0.091s
system ~/projects/jruby $ time jruby -S rake -T > /dev/null
real 0m4.677s
user 0m7.615s
sys 0m0.334s
system ~/projects/jruby $ time jruby -S rake -T > /dev/null
real 0m4.696s
user 0m7.652s
sys 0m0.340s
# Set JAVACMD to the `drip` executable and use JRuby's DripMain to preboot
system ~/projects/jruby $ export JAVACMD=/Users/headius/bin/drip
system ~/projects/jruby $ export DRIP_INIT_CLASS=org.jruby.main.DripMain
# First run is slow, because no Drip instances are up
system ~/projects/jruby $ time jruby -e 1
real 0m1.465s
user 0m2.443s
sys 0m0.124s
# Subsequent runs are prebooted
system ~/projects/jruby $ time jruby -e 1
real 0m0.120s
user 0m0.039s
sys 0m0.051s
system ~/projects/jruby $ time jruby -e 1
real 0m0.116s
user 0m0.039s
sys 0m0.050s
system ~/projects/jruby $ time jruby -e 1
real 0m0.119s
user 0m0.040s
sys 0m0.051s
# Rake gets a modest speedup
system ~/projects/jruby $ time jruby -S rake -T > /dev/null
real 0m5.037s
user 0m8.192s
sys 0m0.415s
system ~/projects/jruby $ time jruby -S rake -T > /dev/null
real 0m3.883s
user 0m0.040s
sys 0m0.051s
system ~/projects/jruby $ time jruby -S rake -T > /dev/null
real 0m3.884s
user 0m0.038s
sys 0m0.049s
# We can add logic to dripmain.rb to preboot more stuff
system ~/projects/jruby $ echo "gem 'rake'; require 'rake'" > dripmain.rb
# Reset Drip instances
system ~/projects/jruby $ drip kill
# Good 50% reduction in startup...and more should be possible
system ~/projects/jruby $ time jruby -S rake -T > /dev/null
real 0m5.406s
user 0m9.337s
sys 0m0.412s
system ~/projects/jruby $ time jruby -S rake -T > /dev/null
real 0m2.784s
user 0m0.039s
sys 0m0.052s
system ~/projects/jruby $ time jruby -S rake -T > /dev/null
real 0m2.751s
user 0m0.038s
sys 0m0.049s
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment