JRuby too slow for development 3

Posted by Andrew Premdas Mon, 26 Sep 2011 23:04:00 GMT

A controversial title which I hope I will be able to amend.

I'm new to JRuby, and the following may be due to my ignorance, which I am trying to address.

Two identical rails projects with almost identical Gemfile's. One running under JRuby 1.6.3 and the other on MRI 1.8.7p352. Running exactly the same specs. JRuby is 20x slower!!!

JRuby

➥  time rspec spec

Person
  can have pets (FAILED - 1)

Pet
  add some examples to (or delete) /Users/andy/repos/diabolo/jruby/rails-example/spec/models/pet_spec.rb (PENDING: Not Yet Implemented)

Pending:
  Pet add some examples to (or delete) /Users/andy/repos/diabolo/jruby/rails-example/spec/models/pet_spec.rb
    # Not Yet Implemented
    # ./spec/models/pet_spec.rb:4

Failures:

  1) Person can have pets
     Failure/Error: alice.pets << fluffy
     NoMethodError:
       undefined method `pets' for #<Person:0x7ec89b0a>
     # org/jruby/RubyKernel.java:238:in `method_missing'
     # ./spec/models/person_spec.rb:7:in `(root)'
     # org/jruby/RubyKernel.java:2061:in `instance_eval'
     # org/jruby/RubyArray.java:2336:in `collect'
     # org/jruby/RubyArray.java:2336:in `collect'

Finished in 0.248 seconds
2 examples, 1 failure, 1 pending

Failed examples:

rspec ./spec/models/person_spec.rb:4 # Person can have pets
org.jruby.exceptions.RaiseException: (SystemExit) exit

real    0m21.324s
user    0m0.001s
sys 0m0.004s

MRI

➥  time rspec spec

Person
  can have pets (FAILED - 1)

Pet
  add some examples to (or delete) /Users/andy/repos/diabolo/mri/rails-example/spec/models/pet_spec.rb (PENDING: Not Yet Implemented)

Pending:
  Pet add some examples to (or delete) /Users/andy/repos/diabolo/mri/rails-example/spec/models/pet_spec.rb
    # Not Yet Implemented
    # ./spec/models/pet_spec.rb:4

Failures:

  1) Person can have pets
     Failure/Error: alice = Person.create!
     ActiveRecord::StatementInvalid:
       Could not find table 'people'
     # ./spec/models/person_spec.rb:5

Finished in 0.01325 seconds
2 examples, 1 failure, 1 pending

Failed examples:

rspec ./spec/models/person_spec.rb:4 # Person can have pets

real    0m1.981s
user    0m1.433s
sys 0m0.546s
Comments

Leave a response

  1. Vasily 6 days later:

    What I got when played with ruby 1.9.2 on win 7 and ubuntu 10 is (empty rails app):

    win 7: specs - 4 secs, cucumber - 37 secs (!); ununtu: specs - 2 secs, cucumber - 11 secs (!)

    Having such a dreadful performance, I can't see how ruby could be used in TDD process :(

    What's interesting, python does not have such a problem - tests for empty Djungo app (there were more than 300 for some strange reason) executed in 3 seconds (!). They run as fast as typical tests in java.

    Yes, I know about faster_require (it just does not work with 1.9.2 at least - ruby claims for cached staff) and about RDB service (it does speed up test running 2x, but it does not enough).

  2. Andrew Premdas 11 days later:

    Thanks for your comment

    My conclusion is 1.8.7 is the ruby of choice for Rails Development at the moment.

  3. Wholesale gadgets 4 months later:

    ere more than 300 for some strange reason) executed in 3 seconds (!). They run as fast as typical tests in java.

    Yes, I know about faster_require (it just does not work with 1.9.2 at least - ruby claims for cached staff)

Comments