The Source for Java Technology Collaboration


Should You Compile With Thumb or ARM Instructions?

On the SPOT devices, we've always compiled using std ARM instructions, not the more compact Thumb set. We also ship with Squawk compiled gcc -o2, not -o3.

Awhile back I ran the Systronix benchmarks (http://www.practicalembeddedjava.com/benchmark/benchmark.html) using Thumb vs. ARM, and -os vs. -o2. Note that this was not for an eSPOT, but ran on a 400MHz ARM11 device (with FP in hardware).

The table below shows size or performance relative to thumb -Os.

Test thumb -Os arm -Os thumb -O2 arm -O2
binary size 1 1.13 1.16 1.28
b-array read 1 1.47 1.04 1.9
b-array copy 1 2.5 1.25 1.67
i-array read 1 1.44 1.01 1.84
i-array copy 1 0.86 1 0.75
byte add 1 1.3 1.07 1.89
byte sub 1 1.3 1.08 1.87
byte mul 1 1.31 1.1 1.89
byte div 1 1.31 1.08 1.74
int add 1 1.49 1.05 2
int sub 1 1.49 1.05 1.97
int mul 1 1.46 1.04 2
int div 1 1.43 1.02 1.79
float add 1 1.46 0.99 1.69
float sub 1 1.44 1.03 1.79
float mul 1 1.45 1.01 1.74
float div 1 1.43 1 1.64
double add 1 1.39 1.04 1.58
double sub 1 1.36 1.02 1.57
double mul 1 1.31 0.99 1.53
double div 1 1.28 1 1.48
Concat 1 1.45 1.02 1.77
Compare 1 1.39 1.01 1.7
method calls 1 1.41 1.01 1.72
New 1 1.34 1.02 1.43
TLE 1 1.43 1.02 1.72
TLE/KB 0.53 0.67 0.47 0.71

So both decisions make a difference in size and speed. Space is still not an issue on the eSPOT, so we've left the options alone.

-- Main.derek_white - 16 Jun 2009

Topic ThumbOrNoThumb . { Edit | Ref-By | Printable | Diffs r1 | More }
 XML java.net RSS

Revision r1 - 16 Jun 2009 - 14:32:50 - Main.derek_white
Parents: WebHome > Squawk > BuildingSquawk