Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

JRuby 9.1.13.0 performance much worse than JRuby 1.7.2 #4908

Closed
rocketraceheroes opened this issue Dec 20, 2017 · 0 comments
Closed

JRuby 9.1.13.0 performance much worse than JRuby 1.7.2 #4908

rocketraceheroes opened this issue Dec 20, 2017 · 0 comments

Comments

@rocketraceheroes
Copy link

rocketraceheroes commented Dec 20, 2017

Environment

*JRuby 9000
*JRuby 1.7.2
*C/MRI Ruby 2.3.3

Expected Behavior

Similar or better performance in JRuby 9000 as JRuby 1.7.2 / C|MRI Ruby 2.3.3

Actual Behavior

Performance is lower by a factor of 4-5x!

JRuby 9000

 Warming up --------------------------------------
        Instantiation   318.000  i/100ms
           Direct hit   354.000  i/100ms
         Class method   327.000  i/100ms
 Calculating -------------------------------------
        Instantiation      3.541k (± 3.5%) i/s -     35.616k in  10.071956s
           Direct hit      3.605k (± 2.6%) i/s -     36.108k in  10.021532s
         Class method      3.646k (± 3.5%) i/s -     36.624k in  10.058927s

 Comparison:
         Class method:     3646.1 i/s
           Direct hit:     3605.5 i/s - same-ish: difference falls within error
        Instantiation:     3540.7 i/s - same-ish: difference falls within error

JRuby 1.7.2

Warming up --------------------------------------
       Instantiation     1.119k i/100ms
          Direct hit     1.252k i/100ms
        Class method     1.335k i/100ms
Calculating -------------------------------------
       Instantiation     13.655k (± 4.8%) i/s -    136.518k
          Direct hit     13.610k (± 4.8%) i/s -    136.468k
        Class method     13.789k (± 4.1%) i/s -    138.840k

Comparison:
        Class method:    13789.3 i/s
       Instantiation:    13654.6 i/s - same-ish: difference falls within error
          Direct hit:    13610.2 i/s - same-ish: difference falls within error

Ruby 2.3.3

Warming up --------------------------------------
       Instantiation     1.542k i/100ms
          Direct hit     1.524k i/100ms
        Class method     1.536k i/100ms
Calculating -------------------------------------
       Instantiation     15.530k (± 4.7%) i/s -    155.742k in  10.051104s
          Direct hit     15.359k (± 5.4%) i/s -    153.924k in  10.051651s
        Class method     15.744k (± 3.8%) i/s -    158.208k in  10.064287s

Comparison:
        Class method:    15744.0 i/s
       Instantiation:    15530.4 i/s - same-ish: difference falls within error
          Direct hit:    15359.1 i/s - same-ish: difference falls within error

Very simple/generic test… JRuby 9000 is 4-5 times slower than JRuby 1.7.2/Ruby 2.3.3

Benchmark

require 'benchmark/ips'

class MyClass
  def self.call
    new.foo
  end

  def self.foo
    a = []
    1_000.times do |i|
      a << i
    end
    a
  end

  def foo
    a = []
    1_000.times do |i|
      a << i
    end
    a
  end
end

Benchmark.ips do |x|
  x.time = 10
  x.warmup = 3
  x.report("Instantiation") { MyClass.call }
  x.report("Direct hit") { MyClass.new.foo }
  x.report("Class method") { MyClass.foo }

  x.compare!
end
@enebo enebo added this to the Invalid or Duplicate milestone Feb 21, 2018
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants