We are considering the transition to jruby, and as part of this study, testing approaches and frameworks were explored. I tested rspec on my local development machine and I believe that the total time taken to execute 2 tests for one class using 2 very simple methods is 7-8 seconds. By simple, I mean one setter and one that returns true.
The rspec output shows that the tests run in about 2 seconds, so 5-6 seconds of the total time is spent loading and initializing rspec. I start from the command line using
C:\rubycode\rspec_tutorial>rspec --profile user_spec.rb .. Top 2 slowest examples: User User should NOT be in any roles not assigned to it 0.023 seconds ./user_spec.rb:15 User User should be in any roles assigned to it 0.006 seconds ./user_spec.rb:10 Finished in 2 seconds 2 examples, 0 failures
I am running jruby 1.6.5 and rspec 2.7.1
I read this post, Faster than RSpec with JRuby, but it's over 1.5 years old, and the answer relates to running test suites, and not to <strong> short bursts of a small number of tests locally to help TDD, and that is how we want to develop. Below we turn on the CI server.
My question is: is this the expected lead time? Is there a way to speed up rspec tests on a local Uner JRUBY machine?
EDIT:
The biggest performance gain was switching from a 64-bit "server" JVM to a 32-bit "client" mode. I saw about a 40% reduction in the time taken to complete a simple test. I also got Nailgun, but performance has changed. The link provided below by banzayman was most useful
source share