Skip to content

JRuby 9k: simple script ~80% as fast as jruby 1.7.19 #2761

@PragTob

Description

@PragTob

This might be related to #2544 - this is based on a benchmark @jasonrclark wrote for shoes4 and I abstracted away everything so what we are left with is fairly simple, a value assignment and returning it:

require 'benchmark/ips'

class FakeDimension
  def initialize
    @margin_start = 10
  end

  def full_direct
    value = @margin_start
    value
  end
end

Benchmark.ips do |benchmark|
  dim = FakeDimension.new
  benchmark.report("full_direct")           { dim.full_direct }
  benchmark.compare!
end

And that script is down to 80% of the 1.7.19 performance on 9k:

tobi@tobi-desktop ~/Documents $ ruby -v
jruby 9.0.0.0-SNAPSHOT (2.2.1) 2015-03-25 d507e49 OpenJDK 64-Bit Server VM 24.75-b04 on 1.7.0_75-b13 +jit [linux-amd64]
tobi@tobi-desktop ~/Documents $ ruby simple_bench.rb 
Calculating -------------------------------------
         full_direct   107.974k i/100ms
-------------------------------------------------
         full_direct      9.128M (±10.9%) i/s -     44.593M
tobi@tobi-desktop ~/Documents $ rvm use jruby
Using /home/tobi/.rvm/gems/jruby-1.7.19
tobi@tobi-desktop ~/Documents $ ruby simple_bench.rb 
Calculating -------------------------------------
         full_direct   173.166k i/100ms
-------------------------------------------------
         full_direct     11.525M (±11.5%) i/s -     56.452M
tobi@tobi-desktop ~/Documents $ ruby -v
jruby 1.7.19 (1.9.3p551) 2015-01-29 20786bd on OpenJDK 64-Bit Server VM 1.7.0_75-b13 +jit [linux-amd64]
tobi@tobi-desktop ~/Documents $ java -version
java version "1.7.0_75"
OpenJDK Runtime Environment (IcedTea 2.5.4) (7u75-2.5.4-1~trusty1)
OpenJDK 64-Bit Server VM (build 24.75-b04, mixed mode)

Rather simple scripts are important to us as we do a ton of small calculations around the dimensions of elements to position them. :)

As always thanks for all your work on JRuby ❤️
Tobi

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions