4

We are considering a move to jruby, and as part of this have been researching testing approaches and frameworks. I've been testing rspec on my local development machine and am finding that the total time taken to run 2 tests for a single class with 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 roughly 2 seconds, so 5-6 seconds of the total time is spent loading and initializing rspec. I'm running 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'm running jruby 1.6.5 and rspec 2.7.1

I've read this post, Faster RSpec with JRuby but it's over 1.5 years old, and the answer relates to running suites of tests as opposed to short bursts of a small number of tests locally to aid TDD, which is how we want to develop. Down the line we'll incorporate a CI server.

My question is, is this the expected execution time? Is there any way to speed up the running of rspec tests on the local development machine uner JRUBY?

EDIT:

Biggest performance gains were switching from 64 bit "server" JVM to 32 bit "client" mode. I saw about a 40% reduction in the time taken to run a simple test. I got Nailgun up and running as well, but performance varied. The link provided below by banzaiman was most helpful

Community
  • 1
  • 1
Barry Jordan
  • 2,666
  • 2
  • 22
  • 24

1 Answers1

1

It is not loading RSpec, but it is JVM startup time you are feeling.

See https://github.com/jruby/jruby/wiki/Improving-startup-time for more information.

banzaiman
  • 2,631
  • 18
  • 27