The smallest code size can be achieved if we restrain from using the compiler alltogether,
and just create a smart linked interpreted application:
> jamaica -smart CaffeineMarkEmbeddedApp
Jamaica Builder Tool
+ CaffeineMarkEmbeddedApp.c
+ CaffeineMarkEmbeddedApp.makefile
Classfile compaction gain: 86.110947% (241514 ==> 33544)
gcc -O2 -o CaffeineMarkEmbeddedApp.o -c CaffeineMarkEmbeddedApp.c ...
gcc -o CaffeineMarkEmbeddedApp CaffeineMarkEmbeddedApp.o /home/...
strip CaffeineMarkEmbeddedApp |
The resulting executable file is very small, only 145KB in our example:
> ll CaffeineMarkEmbeddedApp
-rwxr-xr-x 1 user group 145712 May 24 09:07 CaffeineMarkEmbeddedApp |
But, due to the use of the Jamaica interpreter, the performance is significantly worse
compared to compiled code:
Sieve score = 150 (98)
Loop score = 141 (2017)
Logic score = 151 (0)
String score = 536 (708)
Float score = 130 (185)
Method score = 128 (166650)
Overall score = 174 |