JRuby too slow for development
September 27, 2011
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