Hi, all.
I've done some experiment on 'C' compilers.
the test program i've used is not purely cpu-intensive but more 'mixed'.
Basically it's a routine used to draw on screen2 circles used the well known bresenham algo that allow us to draw circles without doing any kind of floating point math ( and sure no trigonometric evaluations ).
I've compiled the following source under
SDCC, (latest nightly build) with optimizations in speed and
Hitech C 7.5 with all speed optimization on
Here it's the time i've got to draw 100 circles of increasing radius (0-100)
SDCC : 19 secs.
HT7.50: < 10 secs.
the code does not use bios or so dependant compiler features to make time results more independant.
Basically it set the screen mode, fillvrams
and using not optimized pure 'c' code interacts with vram.
The code is not hand-optimized to see how a good compiler could do in this circumstances
Anyone could test this source on other compilers? i'm really curious of the results.(I'm very interested on z88dk, IAR)
Here is the source:
#ifdef SDCC #include <stdio.h> #include <ioport.h> void di() { _asm di _endasm; } void ei() { _asm ei _endasm; } #else #include <stdio.h> #include <sys.h> void di() { asm("di"); } void ei() { asm("ei"); } #endif void vdpsetreg (unsigned char regno, unsigned char value) { di(); #ifdef SDCC out(0x99, value); out(0x99, regno | 0x80); #else outp(0x99, value); outp(0x99, regno | 0x80); #endif ei(); } unsigned char vrampeek(unsigned int addr) { di(); #ifdef SDCC out(0x99, addr & 255); out(0x99, (addr >> 8) & 0x3f); #else outp(0x99, addr & 255); outp(0x99, (addr >> 8) & 0x3f); #endif ei(); #ifdef SDCC return in(0x98); #else return inp(0x98); #endif } void vrampoke(unsigned int addr, unsigned char byte) { di(); #ifdef SDCC out(0x99, addr & 255); out(0x99, 0x40 | ((addr >> 8) & 0x3f)); #else outp(0x99, addr & 255); outp(0x99, 0x40 | ((addr >> 8) & 0x3f)); #endif ei(); #ifdef SDCC out(0x98, byte); #else outp(0x98, byte); #endif } void setpixel(unsigned char x, unsigned char y) { int vramaddr = (x & 0xf8) + (y & 7) + (int)256 * (y>>3); vrampoke(vramaddr, vrampeek(vramaddr) | (128 >> (x & 7)) ); } void sc2() { unsigned char r; static unsigned char vdpregs[] = {0x02,0x60,0x06,0xFF, 0x03, 0x36, 0x07,0x04}; for (r =0;r