Z80 code size

From SDCC wiki
Jump to: navigation, search

Contents

z80 (and related ports) code size

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

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¹
cvu_vinb.c 18 39 26 28 9 12 12
galois_lfsr.c 54 39 20 62 19 13 27 18
get_tile.c 202 190 159 171 124 109 109
huffman_iterative.c fails / 385 fails / 278 222 441 131 89 241 215
huffman_recursive.c fails / 521 fails / 470 299 662 161 240 224
init_loop.c 74 52 45 fails 38 26 26
insertion_sort.c 301 155 581 199 133 138 147 134
memcpy_compression.c fails / 80 93 100 163 68 77 77
memtovmemcpy.c 118 82 86 fails 60 75 75
play_music.c fails / 821 708 581 1309 426 584 545
sdcc_mullong.c 340 265 268 fails 219 575 559
set_screen_mode.c fails / 95 65 57 151 50 49 50
set_sprite_x.c 130 128 108 232 77 60 110 98
z88dk-mktime.c 453 425 409 fails 294 561 561
total fails / 3592 fails / 2989 2961 fails 1809 2832 2703

Rabbit 2000 Code size comparison (bytes):

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


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.

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