-
-
Notifications
You must be signed in to change notification settings - Fork 942
Closed
Milestone
Description
Environment
Rubies:
jruby 9.1.8.0 (2.3.1) 2017-03-06 90fc7ab Java HotSpot(TM) 64-Bit Server VM 25.131-b11 on 1.8.0_131-b11 +jit [linux-x86_64]
Linux: Linux maruchan 4.10.0-20-generic #22-Ubuntu SMP Thu Apr 20 09:22:42 UTC 2017 x86_64 x86_64 x86_64 GNU/Linux
Expected Behavior
Performance on the benchmark below consistently regresses when running JRuby with -Xcompile.invokedynamic=true.
I was under the impression that after warmup, running JRuby with invokedynamic should never be slower than without it, but that does not seem to be the case on this benchmark.
require 'benchmark/ips'
require 'oat'
require 'oat/adapters/hal'
class Foo
attr_reader :foo, :bar, :baz
def initialize(**values)
values.each do |(key, value)|
respond_to?(key) ? instance_variable_set(:"@#{key}", value) : raise
end
end
end
class FooSerializer < Oat::Serializer
adapter Oat::Adapters::HAL
schema do
property :foo, item.foo
property :bar, item.bar
property :baz, item.baz
end
end
puts "Running with #{RUBY_DESCRIPTION} (JRUBY_OPTS: #{ENV['JRUBY_OPTS']})"
FOO = Foo.new(foo: 1, bar: 2, baz: 'baz')
Benchmark.ips do |benchmark|
benchmark.time = 120
benchmark.warmup = 120
benchmark.report('FooSerializer') { FooSerializer.new(FOO).to_hash }
benchmark.compare!
endActual Behavior
- Without invokedynamic:
FooSerializer 251.627k (±23.9%) i/s - 28.264M in 120.011879s - With invokedynamic:
FooSerializer 33.785k (± 6.9%) i/s - 4.032M in 120.030513s
I've also tested with latest master and while the numbers go up slightly in either case, the general relation between the two results keeps the same.
Reactions are currently unavailable