Skip to content

[AArch64] Reflection calls from JRuby are slow on GraalVM vs. HotSpot #6600

Open
@lewurm

Description

@lewurm

As reported by @headius (see #2666 (comment) ), GraalVM executes this JRuby snippet much slower on AArch64 than HotSpot:

Runtime = java.lang.Runtime
loop {
  t = Time.new
  i = 0
  while i < 100_000_000
    i += 1
    Runtime.runtime
  end
  puts Time.now - t
}

I observed a slowdown of ~2x on linux-aarch64 and ~6x on darwin-aarch64 compared to HotSpot (using the same JAVA_HOME that was used to build GraalVM). I did not see any slowdown on darwin-amd64; I could not verify that on linux-amd64 would be great if someone could check this platform, so we know that this is issue is specific to AArch64.

Instructions on darwin-aarch64:

$ brew install jruby
$ JAVA_HOME=$labs_jdk_of_your_choice jruby -v -Xcompile.invokedynamic -e 'Runtime = java.lang.Runtime; loop { t = Time.new; i = 0; while i < 100_000_000; i += 1; Runtime.runtime; end; puts Time.now - t }'
jruby 9.4.2.0 (3.1.0) 2023-03-08 90d2913fda Java HotSpot(TM) 64-Bit Server VM 20.0.1+9-jvmci-23.0-b10 on 20.0.1+9-jvmci-23.0-b10 +indy +jit [arm64-darwin]
2.379717
2.2683880000000003
2.267346
^C
$ cd $graal_repo/vm
$ JAVA_HOME=$labs_jdk_of_your_choice mx --env ce-aarch64-darwin build
$ JAVA_HOME=`mx --env ce-aarch64-darwin graalvm-home` jruby -v -Xcompile.invokedynamic -e 'Runtime = java.lang.Runtime; loop { t = Time.new; i = 0; while i < 100_000_000; i += 1; Runtime.runtime; end; puts Time.now - t }'
13.344807000000001
13.256523
13.325128
^C

Metadata

Metadata

Assignees

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions