Closed
Description
Describe the Issue
I was testing performance in native-image. so i decided to test for loop
graalvm 23.0.1 os: linux arch: x86_64
Code:
class Main {
public static void main(String[] args) {
for (int i = 0; i < Integer.parseInt(args[0]); i++);
}
}
native image compilation command: native-image -O3 -march=native Main
Using the latest version of GraalVM can resolve many issues.
- I tried with the latest version of GraalVM.
GraalVM Version
java 23.0.1 2024-10-15
Java(TM) SE Runtime Environment Oracle GraalVM 23.0.1+11.1 (build 23.0.1+11-jvmci-b01)
Java HotSpot(TM) 64-Bit Server VM Oracle GraalVM 23.0.1+11.1 (build 23.0.1+11-jvmci-b01, mixed mode, sharing)
Operating System and Version
Linux fedora 6.12.6-200.fc41.x86_64 #1 SMP PREEMPT_DYNAMIC Thu Dec 19 21:06:34 UTC 2024 x86_64 GNU/Linux
Troubleshooting Confirmation
- I tried the suggestions in the troubleshooting guide.
Run Command
./main 99999999
java Main 99999999
Expected Behavior
native-image should have run faster
Actual Behavior
native image is 5 times slower
Steps to Reproduce
- create java file with
class Main {
public static void main(String[] args) {
for (int i = 0; i < Integer.parseInt(args[0]); i++);
}
}
- compile it with java and native image
native-image -O3 -march=native Main
- and run them
Additional Context
No response
Run-Time Log Output and Error Messages
No response