Skip to content

Instantly share code, notes, and snippets.

@dnagir
Created December 2, 2011 13:44
Show Gist options
  • Save dnagir/1423288 to your computer and use it in GitHub Desktop.
Save dnagir/1423288 to your computer and use it in GitHub Desktop.
JRuby vs Ruby 1.9.3
# | wall time | specs |
# JRuby | 69s | 34s |
# Ruby 1.9.3 | 28s | 16s |
# x faster | x2.5 | 2.1 |
> ruby -v
jruby 1.6.5 (ruby-1.9.2-p136) (2011-10-25 9dcd388) (Java HotSpot(TM) 64-Bit Server VM 1.6.0_29) [darwin-x86_64-java]
> time bundle exec rspec spec
Finished in 33.8 seconds
280 examples, 0 failures, 4 pending
real 1m8.601s
user 1m25.986s
sys 0m4.728s
> ruby -v
ruby 1.9.3p0 (2011-10-30 revision 33570) [x86_64-darwin11.2.0]
> time bundle exec rspec spec
Finished in 15.56 seconds
280 examples, 0 failures, 4 pending
real 0m27.618s
user 0m17.707s
sys 0m1.877s
@headius
Copy link

headius commented Dec 2, 2011

--ng-server should still work in 1.6.x.

The time you see there for specs is worst-case. Slow initial performance is not just about startup, it's about warmup time. JRuby is an optimizing impl, and so code will run slow at first. Once it gets a chance to warm up, it will improve.

As an app runs longer, JRuby should warm up, and should beat C Ruby in every case.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment