«previous next»

SwiftX Benchmarks

Optimizing Compiler

The benchmarks in the table below show the performance gains achieved by using the optimizing compiler included in SwiftX Pro. Also shown are some simple examples of source code and the resulting optimized versions.

Because such optimization on microcontrollers with relatively limited resources results in nearly negligible results, figures are given here only for processors which show significant improvement with this feature enabled.

Not optimized

Optimized  

Improvement  

68332

Size

Time

Size

Time  

Size

Time  

Sieve

110

563

104

289  

5.5%

48.7%  

Fib

36

1875

30

1078  

16.7%

42.5%  

Qsort

648

180

610

148  

5.9%

17.8%  

CF5307

Size

Time

Size

Time  

Size

Time  

Sieve

140

32

114

16  

18.6%

50.0%  

Fib

36

122

28

66  

22.2%

45.9%  

Qsort

650

8

542

6  

16.6%

25.0%  

*Code optimization has the most impact on MCUs such as those listed in the above table, which take advantage of the Freescale BDM. Results on MCUs with fewer resources (see 68HC12 example below) are likely to be more modest but, depending on the application, still significant.



 

Example #1 — 68K code without optimizer

ColdFire code is similar, but it is not identical because it does not implement the full 68K instruction set.

 1944   X1 BSR                     61EE
 1946   A6 ) A0 MOV                2056
 1948   A0 ) A6 ) MOV              2C90
 194A   X2 BSR                     61F0
 194C   A6 )+ A0 MOV               205E
 194E   A6 )+ A0 ) MOV             209E
 1950   RTS                        4E75

 

Example #1 — 68K code, optimized

 193C   X1 AB X2 AB MOV      23F90000C6140000C618
 1946   RTS                  4E75


 

Example #2 — source code

DIGIT — from the SwiftX kernel source code — converts a binary value to a printable ASCII digit.

 : DIGIT ( u -- char)
   DUP 9 > IF  7 +  THEN  [CHAR] 0 + ;

 

Example #2 — 68K code without optimizer

 1926   A6 ) A6 -) MOV             2D16
 1928   9 #Q D0 MOV                7009
 192A   D0 A6 -) MOV               2D00
 192C   > BSR                      6100EC50
 1930   A6 )+ TST                  4A9E
 1932   193E BEQ                   6700000A
 1936   7 #Q D0 MOV                7007
 1938   D0 A6 -) MOV               2D00
 193A   A6 )+ D0 MOV               201E
 193C   D0 A6 ) ADD                D196
 193E   30 #Q D0 MOV               7030
 1940   D0 A6 -) MOV               2D00
 1942   A6 )+ D0 MOV               201E
 1944   D0 A6 ) ADD                D196
 1946   RTS                        4E75

 

Example #2 — 68K code, optimized

 0B92   9 # A6 ) CMP               0C9600000009
 0B98   0B9E BLE                   6F000004
 0B9C   7 #Q A6 ) ADD              5E96
 0B9E   30 #Q D0 MOV               7030
 0BA0   D0 A6 ) ADD                D196
 0BA2   RTS                        4E75

 

Example #2 — 68HC12 code without optimizer

31 bytes. 50,000 iterations = 1125 ms.

 477F   0 ,Y 2 ,-Y MOVW            1802406E
 4783   9 # 2 ,-Y MOVW             18006E0009
 4788   > JSR                      1681DD
 478B   2 ,Y+ LDD                  EC71
 478D   4799 LBEQ                  18270008
 4791   7 # 2 ,-Y MOVW             18006E0007
 4796   + JSR                      168160
 4799   30 # 2 ,-Y MOVW            18006E0030
 479E   + JMP                      068160

 

Example #2 — 68HC12 code, optimized

32 bytes. 50,000 iterations = 946 ms. = 15% faster!

 46FF   0 ,Y 2 ,-Y MOVW            1802406E
 4703   9 # 2 ,-Y MOVW             18006E0009
 4708   > JSR                      1681DD
 470B   2 ,Y+ LDD                  EC71
 470D   4718 LBEQ                  18270007
 4711   0 ,Y LDD                   EC40
 4713   7 # ADDD                   C30007
 4716   0 ,Y STD                   6C40
 4718   0 ,Y LDD                   EC40
 471A   30 # ADDD                  C30030
 471D   0 ,Y STD                   6C40
 471F   RTS                        3D

«previous next»