-
-
Save dnagir/1423288 to your computer and use it in GitHub Desktop.
# | 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 |
I haven't. Can't see the point really.
It is obvious from the results that specs are 2x slower anyway (see the spec output: Finished in...).
This doesn't take into account the Rails boot time:
In 1.9.3 it is 28s - 16s = 12s
.
In JRuby it is 69s - 34s - jvm = 12s x 2
.
(12x2 - 2 times slower than 1.9.3).
Thus I can conclude that JVM startup time is ~ jvm = 69s - 34s - 12s x 2 = 11s
.
This means that if I totally dismiss JVM startup time, the total time will be 58s
instead of 69s
.
In 1.9.3 it is 28s
and still almost 2x faster.
BTW, the ruby --ng-server
is not even a valid option in JRuby 1.6. I think it was removed.
--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.
Yes, it is important to be able to run RSpec fast.
Have you tried nailgun ? Maybe a lot of time is spend on starting and warming up the JVM ?
Try something like this: ruby --ng-server &; jruby --ng -S bundle exec rspec spec