Difference between revisions of "Z80 code size"

From SDCC wiki
Jump to: navigation, search
 
m (Rabbit 2000 Code size comparison (bytes):)
 
(6 intermediate revisions by one user not shown)
Line 2: Line 2:
  
 
A history of code size in sdcc and a comparison to other compilers.
 
A history of code size in sdcc and a comparison to other compilers.
 +
 +
Note: these benchmarks are not representative. A long time ago, the files were originally chosen as examples of source for which SDCC generates particularly bad code for the Z80; the purpose of the table is mostly to see the progress of SDCC.
  
 
== Z80 Code size comparison (bytes): ==
 
== Z80 Code size comparison (bytes): ==
Line 12: Line 14:
 
! IAR 4.06A  
 
! IAR 4.06A  
 
! hand asm  
 
! hand asm  
! sdcc 3.1.5 !#7830¹  
+
! sdcc 3.1.5 #7830¹  
! sdcc-lospre !#8070¹
+
! sdcc-lospre #8070¹²
 +
! sdcc 3.5.5 #9383¹
 +
! sdcc 3.6.9 #10107¹
 
|-  
 
|-  
 
|  cvu_vinb.c  
 
|  cvu_vinb.c  
Line 23: Line 27:
 
|   
 
|   
 
|  12  
 
|  12  
 +
|  12
 +
|  12
 
|  12
 
|  12
 
|-  
 
|-  
Line 34: Line 40:
 
|  27  
 
|  27  
 
|  '''18'''
 
|  '''18'''
 +
|  25
 +
|  23
 
|-  
 
|-  
 
|  get_tile.c  
 
|  get_tile.c  
Line 42: Line 50:
 
|  124  
 
|  124  
 
|   
 
|   
'''109'''  
+
|  109'
|  '''109'''
+
|  109
 +
|  103
 +
|  '''102'''
 
|-  
 
|-  
 
|  huffman_iterative.c  
 
|  huffman_iterative.c  
Line 54: Line 64:
 
|  241  
 
|  241  
 
|  215
 
|  215
 +
|  206
 +
|  241
 
|-  
 
|-  
 
|  huffman_recursive.c  
 
|  huffman_recursive.c  
Line 64: Line 76:
 
|  240  
 
|  240  
 
|  224
 
|  224
 +
|  221
 +
|  217
 
|-  
 
|-  
 
|  init_loop.c  
 
|  init_loop.c  
Line 72: Line 86:
 
|  38  
 
|  38  
 
|   
 
|   
'''26'''
+
|  26
|  '''26'''
+
|  26
 +
|  '''25'''
 +
|  27
 
|-  
 
|-  
 
|  insertion_sort.c  
 
|  insertion_sort.c  
Line 84: Line 100:
 
|  147  
 
|  147  
 
|  134
 
|  134
 +
|  139
 +
|  132
 
|-  
 
|-  
 
|  memcpy_compression.c  
 
|  memcpy_compression.c  
Line 94: Line 112:
 
|  77  
 
|  77  
 
|  77
 
|  77
 +
|  73
 +
|  72
 
|-  
 
|-  
 
|  memtovmemcpy.c  
 
|  memtovmemcpy.c  
Line 103: Line 123:
 
|   
 
|   
 
|  75  
 
|  75  
 +
|  75
 +
|  75
 
|  75
 
|  75
 
|-  
 
|-  
Line 114: Line 136:
 
|  584  
 
|  584  
 
|  545
 
|  545
 +
|  586
 +
|  544
 
|-  
 
|-  
 
|  sdcc_mullong.c  
 
|  sdcc_mullong.c  
Line 124: Line 148:
 
|  575  
 
|  575  
 
|  559
 
|  559
 +
|  595
 +
|  575
 
|-  
 
|-  
 
|  set_screen_mode.c  
 
|  set_screen_mode.c  
Line 133: Line 159:
 
|   
 
|   
 
|  '''49'''  
 
|  '''49'''  
 +
|  50
 +
|  50
 
|  50
 
|  50
 
|-  
 
|-  
Line 144: Line 172:
 
|  110  
 
|  110  
 
|  98
 
|  98
 +
|  93
 +
|  93
 
|-  
 
|-  
 
|  z88dk-mktime.c  
 
|  z88dk-mktime.c  
Line 154: Line 184:
 
|  561  
 
|  561  
 
|  561
 
|  561
 +
|  482
 +
|  502
 
|-  
 
|-  
 
|  total  
 
|  total  
Line 164: Line 196:
 
|  2832  
 
|  2832  
 
|  2703
 
|  2703
 +
|  2685
 +
|  2665
 
|}
 
|}
 
  
 
== Rabbit 2000 Code size comparison (bytes): ==
 
== Rabbit 2000 Code size comparison (bytes): ==
Line 175: Line 208:
 
! sdcc 3.1.5 !#7830¹  
 
! sdcc 3.1.5 !#7830¹  
 
! sdcc-lospre !#8032¹²
 
! sdcc-lospre !#8032¹²
 +
! sdcc 3.6.9 #10107¹
 
|-  
 
|-  
 
|  cvu_vinb.c  
 
|  cvu_vinb.c  
Line 180: Line 214:
 
|  24  
 
|  24  
 
|  '''10'''  
 
|  '''10'''  
 +
|  '''10'''
 
|  '''10'''
 
|  '''10'''
 
|-  
 
|-  
Line 186: Line 221:
 
|  33  
 
|  33  
 
|  27  
 
|  27  
 +
|  '''18'''
 
|  '''18'''
 
|  '''18'''
 
|-  
 
|-  
Line 191: Line 227:
 
|  fails / 225  
 
|  fails / 225  
 
|  fails / 161  
 
|  fails / 161  
'''101'''
+
|  101
|  '''101'''
+
|  101
 +
|  '''94'''
 
|-  
 
|-  
 
|  huffman_iterative.c  
 
|  huffman_iterative.c  
Line 199: Line 236:
 
|  209  
 
|  209  
 
|  '''193'''
 
|  '''193'''
 +
|  197
 
|-  
 
|-  
 
|  huffman_recursive.c  
 
|  huffman_recursive.c  
Line 204: Line 242:
 
|  371  
 
|  371  
 
|  219  
 
|  219  
|  '''209'''
+
|  209
 +
|  '''194'''
 
|-  
 
|-  
 
|  init_loop.c  
 
|  init_loop.c  
Line 210: Line 249:
 
|  55  
 
|  55  
 
|  '''26'''  
 
|  '''26'''  
 +
|  '''26'''
 
|  '''26'''
 
|  '''26'''
 
|-  
 
|-  
Line 216: Line 256:
 
|  146  
 
|  146  
 
|  143  
 
|  143  
|  '''139'''
+
|  139
 +
|  '''127'''
 
|-  
 
|-  
 
|  memcpy_compression.c  
 
|  memcpy_compression.c  
Line 223: Line 264:
 
|  '''67'''  
 
|  '''67'''  
 
|  '''67'''
 
|  '''67'''
 +
|  68
 
|-  
 
|-  
 
|  memtovmemcpy.c  
 
|  memtovmemcpy.c  
Line 228: Line 270:
 
|  68  
 
|  68  
 
|  '''53'''  
 
|  '''53'''  
 +
|  '''53'''
 
|  '''53'''
 
|  '''53'''
 
|-  
 
|-  
Line 234: Line 277:
 
|  579  
 
|  579  
 
|  494  
 
|  494  
|  '''472'''
+
|  472
 +
|  '''442'''
 
|-  
 
|-  
 
|  sdcc_mullong.c  
 
|  sdcc_mullong.c  
Line 241: Line 285:
 
|  414  
 
|  414  
 
|  371
 
|  371
 +
|  366
 
|-  
 
|-  
 
|  set_screen_mode.c  
 
|  set_screen_mode.c  
Line 246: Line 291:
 
|  66  
 
|  66  
 
|  '''49'''  
 
|  '''49'''  
 +
|  50
 
|  50
 
|  50
 
|-  
 
|-  
Line 252: Line 298:
 
|  98  
 
|  98  
 
|  97  
 
|  97  
|  '''87'''
+
|  87
 +
|  '''82'''
 
|-  
 
|-  
 
|  z88dk-mktime.c  
 
|  z88dk-mktime.c  
Line 259: Line 306:
 
|  507  
 
|  507  
 
|  503
 
|  503
 +
|  443
 
|-  
 
|-  
 
|  total  
 
|  total  
Line 264: Line 312:
 
|  fails / 2564  
 
|  fails / 2564  
 
|  2416  
 
|  2416  
|  '''2299'''
+
|  2299
 +
|  '''2170'''
 
|}
 
|}
  

Latest revision as of 07:44, 29 October 2017

Contents

[edit] z80 (and related ports) code size

A history of code size in sdcc and a comparison to other compilers.

Note: these benchmarks are not representative. A long time ago, the files were originally chosen as examples of source for which SDCC generates particularly bad code for the Z80; the purpose of the table is mostly to see the progress of SDCC.

[edit] Z80 Code size comparison (bytes):

File z88dk 1.8 CROSS-C 2.57.02 HITECH-C 7.80PL2 ADC 5.02 IAR 4.06A hand asm sdcc 3.1.5 #7830¹ sdcc-lospre #8070¹² sdcc 3.5.5 #9383¹ sdcc 3.6.9 #10107¹
cvu_vinb.c 18 39 26 28 9 12 12 12 12
galois_lfsr.c 54 39 20 62 19 13 27 18 25 23
get_tile.c 202 190 159 171 124 109' 109 103 102
huffman_iterative.c fails / 385 fails / 278 222 441 131 89 241 215 206 241
huffman_recursive.c fails / 521 fails / 470 299 662 161 240 224 221 217
init_loop.c 74 52 45 fails 38 26 26 25 27
insertion_sort.c 301 155 581 199 133 138 147 134 139 132
memcpy_compression.c fails / 80 93 100 163 68 77 77 73 72
memtovmemcpy.c 118 82 86 fails 60 75 75 75 75
play_music.c fails / 821 708 581 1309 426 584 545 586 544
sdcc_mullong.c 340 265 268 fails 219 575 559 595 575
set_screen_mode.c fails / 95 65 57 151 50 49 50 50 50
set_sprite_x.c 130 128 108 232 77 60 110 98 93 93
z88dk-mktime.c 453 425 409 fails 294 561 561 482 502
total fails / 3592 fails / 2989 2961 fails 1809 2832 2703 2685 2665

[edit] Rabbit 2000 Code size comparison (bytes):

File Dynamic C 9.62 CROSS-C 2.18.01 sdcc 3.1.5 !#7830¹ sdcc-lospre !#8032¹² sdcc 3.6.9 #10107¹
cvu_vinb.c fails / 30 24 10 10 10
galois_lfsr.c fails / 76 33 27 18 18
get_tile.c fails / 225 fails / 161 101 101 94
huffman_iterative.c fails 214 209 193 197
huffman_recursive.c fails 371 219 209 194
init_loop.c fails / 109 55 26 26 26
insertion_sort.c 273 146 143 139 127
memcpy_compression.c fails 68 67 67 68
memtovmemcpy.c 103 68 53 53 53
play_music.c 585 579 494 472 442
sdcc_mullong.c 374 252 414 371 366
set_screen_mode.c fails / 110 66 49 50 50
set_sprite_x.c 148 98 97 87 82
z88dk-mktime.c fails 429 507 503 443
total fails fails / 2564 2416 2299 2170


Total code size and compilation time over revisions (1M means --max-allocs-per-node 1000000):

graph-z80.png

The benchmark files can be found at http://colecovision.eu/stuff/testbench.tar.gz

Command line: sdcc -mz80 --opt-code-size --std-c89, zcc -O2, ZC -O. For z88dk, Dynamic C and CROSS-C slightly modified versions of the source have been used where the original didn't compile (still marked with "fails" though).

¹ --max-allocs-per-node 5000000, runtime approx. 13min.

² Experimental sdcc from lospre branch.

[edit] Code size vs. compilation time:

The --max-allocs-per-node parameter provides a code size vs. compilation speed trade-off:

test.png

Philipp

Personal tools
Namespaces

Variants
Actions
Navigation
Toolbox