Categories
computers suck

Faster Java on Raspberry Pi

With the official announcement of Oracle Java on Raspberry Pi, Java just got usable on the Raspberry Pi. It’s still not super-fast, but I’m seeing ~10× speedup over OpenJDK.

To install it (on Raspbian):

sudo apt-get update && sudo apt-get install oracle-java7-jdk
sudo update-java-alternatives -s jdk-7-oracle-armhf

By way of a baseline, here are SciMark 2.0 results on OpenJDK:

$ java -classpath ./scimark2lib.jar jnt.scimark2.commandline -large

SciMark 2.0a

Composite Score: 2.4987047508570632
FFT (1048576): 1.5550941987343943
SOR (1000x1000):   5.32030759023185
Monte Carlo : 0.6005590152716936
Sparse matmult (N=100000, nz=1000000): 2.3584905938878946
LU (1000x1000): 2.6590723561594847

java.vendor: Sun Microsystems Inc.
java.version: 1.6.0_27
os.arch: arm
os.name: Linux
os.version: 3.6.11+

Here’s what the Oracle JDK cranks out (bigger numbers → better):

$ java -classpath ./scimark2lib.jar jnt.scimark2.commandline -large

SciMark 2.0a

Composite Score: 14.94896390647437
FFT (1048576): 6.953238474333376
SOR (1000x1000):   33.91437255527547
Monte Carlo : 8.869794361002157
Sparse matmult (N=100000, nz=1000000): 9.81896340073432
LU (1000x1000): 15.188450741026523

java.vendor: Oracle Corporation
java.version: 1.7.0_40
os.arch: arm
os.name: Linux
os.version: 3.6.11+

That’s a tidy increase, and might make Processing and Arduino much easier to work with.

(It’s still not tremendously fast, though. My i7 quad-core has a composite score of nearly 1450 …)

9 replies on “Faster Java on Raspberry Pi”

Wow, that’s quite a difference. I was wondering if the difference is still large if you run the test without the ‘–large’ argument (so to rule out the memory/cache factor).

I think ‘-large’ makes it slightly slower than the default. Running anything in Processing will be the real test.

Overclocked @900MHz:

Composite Score: 17.876462588362237
FFT (1048576): 7.531491739085088
SOR (1000×1000): 40.44242199114882
Monte Carlo : 11.467679645892852
Sparse matmult (N=100000, nz=1000000): 11.717318869332049
LU (1000×1000): 18.223400696352392

Update: I did a run on the new Raspberry Pi 2:

Composite Score: 32.36467842514499
FFT (1048576): 9.914229972288283
SOR (1000×1000): 74.85007667302958
Monte Carlo : 15.864979597493978
Sparse matmult (N=100000, nz=1000000): 23.005031814567598
LU (1000×1000): 38.18907406834551

java.vendor: Oracle Corporation
java.version: 1.7.0_40
os.arch: arm
os.name: Linux
os.version: 3.18.6-v7i-aufs

That’s quite a big difference considering the bench is using only a single core (according to the scimark FAQ it’s single-threaded).

pi3 Suse aarch64 Oracle Jdk 1.8 x64
SciMark 2.0a

Composite Score: 73.94354769602046
FFT (1048576): 14.164310995231187
SOR (1000×1000): 120.28637777812554
Monte Carlo : 63.3999629050567
Sparse matmult (N=100000, nz=1000000): 41.53147283811324
LU (1000×1000): 130.33561396357564

java.vendor: Oracle Corporation
java.version: 1.8.0_111
os.arch: aarch64
os.name: Linux
os.version: 4.4.36-8-default

Hmm, some unusual differences there over my Raspbian results on a Raspberry Pi 3. I wonder if it’s due to thermal issues?

SciMark 2.0a

Composite Score: 67.91266516635812
FFT (1048576): 18.20815673821697
SOR (1000×1000): 164.1252153058329
Monte Carlo : 25.31454674484949
Sparse matmult (N=100000, nz=1000000): 53.511706581678546
LU (1000×1000): 78.4037004612127

java.vendor: Oracle Corporation
java.version: 1.8.0_65
os.arch: arm
os.name: Linux
os.version: 4.4.34-v7+

Leave a Reply

Your email address will not be published. Required fields are marked *