Why is there such a performance difference on Raspberry pi between Open and Oracle JDK?
OpenJDK Zero VM is an interpreter only JVM. On the one hand, it's easier to port because it has no architecture specific assembly code but, on the other hand, it's not performant because it has no architecture specific assembly code.
OracleJDK takes advantage of the platform's floating point ABI (Soft Float on RP1 and Hard Float on RP2). I can imagine it has quite an amount of assembly code, specific to the ARM architecture, and that is why it scores better.
A JIT compiler named Shark, based on LLVM, was introduced in OpenJDK Zero VM early on. I'm not sure if your system's OpenJDK was build with Shark but it probably was. It provides a compromise between not having assembly code and still running efficient native code. If Shark is not enabled then building IcedTea with Shark enabled will improve performance. If Shark is enabled then that is the reason why OpenJDK does not suck as much.
An update for April 2018.
I run a Java Whetstone off-line benchmark on Raspberry Pi 3 with Raspbian Stretch. The source code can be found here in file Raspberry_Pi_Benchmarks/java/source code/whetstone-off-line/whetstc.java
.
The conclusion is that openjdk-9-jre is faster than openjdk-8-jre (tested version 1.8.0_162), which is in turn faster than oracle-java8-jdk (tested version 1.8.0_65). Note also that I used an older kernel with oracle-java8-jdk.
openjdk-9-jdk from Raspbian repos:
$ java -versionopenjdk version "9-Raspbian"OpenJDK Runtime Environment (build 9-Raspbian+0-9b181-4bpo9rpt1)OpenJDK Server VM (build 9-Raspbian+0-9b181-4bpo9rpt1, mixed mode)$ java whetstc Whetstone Benchmark Java Version, apr. 26 2018, 23:15:40 1 PassTest Result MFLOPS MOPS millisecsN1 floating point -1,124750137 333,22 0,0576N2 floating point -1,131330490 293,19 0,4584N3 if then else 1,000000000 185,95 0,5566N4 fixed point 12,000000000 412,95 0,7628N5 sin,cos etc. 0,499110132 22,40 3,7140N6 floating point 0,999999821 212,70 2,5360N7 assignments 3,000000000 105,66 1,7490N8 exp,sqrt etc. 0,825148463 16,70 2,2280MWIPS 829,02 12,0624Operating System Linux, Arch. arm, Version 4.14.34-v7+Java Vendor Oracle Corporation, Version 9-RaspbianCPU null
openjdk-8-jdk from Raspbian repos:
$ java -versionopenjdk version "1.8.0_162"OpenJDK Runtime Environment (build 1.8.0_162-8u162-b12-1~deb9u1-b12)OpenJDK Client VM (build 25.162-b12, mixed mode)$ java whetstc Whetstone Benchmark Java Version, Apr 27 2018, 13:13:26 1 PassTest Result MFLOPS MOPS millisecsN1 floating point -1.124750137 181.82 0.1056N2 floating point -1.131330490 175.92 0.7640N3 if then else 1.000000000 88.61 1.1680N4 fixed point 12.000000000 389.85 0.8080N5 sin,cos etc. 0.499110132 9.35 8.8980N6 floating point 0.999999821 76.27 7.0720N7 assignments 3.000000000 275.82 0.6700N8 exp,sqrt etc. 0.825148463 7.15 5.2060MWIPS 405.00 24.6916Operating System Linux, Arch. arm, Version 4.14.34-v7+Java Vendor Oracle Corporation, Version 1.8.0_162CPU null
oracle-java8-jdk from Raspbian repos:
$ java -versionjava version "1.8.0_65"Java(TM) SE Runtime Environment (build 1.8.0_65-b17)Java HotSpot(TM) Client VM (build 25.65-b01, mixed mode)`$ java whetstc Whetstone Benchmark Java Version, Nov 15 2017, 11:16:37 1 PassTest Result MFLOPS MOPS millisecsN1 floating point -1.124750137 91.52 0.2098N2 floating point -1.131330490 89.01 1.5100N3 if then else 1.000000000 44.27 2.3380N4 fixed point 12.000000000 229.76 1.3710N5 sin,cos etc. 0.499110103 3.01 27.6400N6 floating point 0.999999821 44.95 12.0000N7 assignments 3.000000000 137.09 1.3480N8 exp,sqrt etc. 0.751108646 0.58 63.9100MWIPS 90.64 110.3268Operating System Linux, Arch. arm, Version 4.9.35-v7+Java Vendor Oracle Corporation, Version 1.8.0_65CPU null