C compiler comparison - part two

Page 3/5
1 | 2 | | 4 | 5

Par ARTRAG

Enlighted (6843)

Portrait de ARTRAG

03-10-2008, 19:20

FYI
when disabling the static allocation of autos
the execution time rises to 0x2ef frames, i.e. 15 secs

Par PingPong

Prophet (3889)

Portrait de PingPong

04-10-2008, 10:38

That's an improvement, for sure. But i think HT for PC is far away from IAR. The latter appear to perform almost like SDCC.

Par PingPong

Prophet (3889)

Portrait de PingPong

04-10-2008, 15:36

I see also some true gems:
vrampeek:

LD A,E
AND 255 <-- A AND 255 always equal to A!
OUT (153),A
LD L,(IX+2) <-- Load L, ok Smile
LD H,(IX+3) <-- Load H,ok Smile
LD L,H <- LD l from H? Tongue
LD H,0 <- LD H with zero? And the previous ld ? Tongue
LD A,L <- LD A,L that is loaded with H that is loaded with (IX+3) TongueTongueTongueTongueTongue
AND 63
OUT (153),A

Par Yukio

Paragon (1540)

Portrait de Yukio

05-10-2008, 12:56

Z80.
Now there is a MSX specific information:
Z88DK
Their updated the informations ...

Par ARTRAG

Enlighted (6843)

Portrait de ARTRAG

05-10-2008, 17:18

I see also some true gems:
vrampeek:

LD A,E
AND 255 <-- A AND 255 always equal to A!
OUT (153),A
LD L,(IX+2) <-- Load L, ok Smile
LD H,(IX+3) <-- Load H,ok Smile
LD L,H <- LD l from H? Tongue
LD H,0 <- LD H with zero? And the previous ld ? Tongue
LD A,L <- LD A,L that is loaded with H that is loaded with (IX+3) TongueTongueTongueTongueTongue
AND 63
OUT (153),A


Well, HTC too has some problems, but i'd say IAR has chosen the worst place to put inefficiency

Par PingPong

Prophet (3889)

Portrait de PingPong

05-10-2008, 18:05

Hey ARTRAG, i've done some comparative test from HTC and z88dk. The test is similar, times:

HTC: 8/9 secs
z88dk: 21 secs. Sad

Here the list


#include <stdio.h>
#include <sys.h>

#define EI asm("ei");
#define DI asm("di");

void vdpsetreg (unsigned char regno, unsigned char value)
{
	DI
	outp(0x99, value);
	outp(0x99, regno | 0x80);
	EI
}

unsigned char vrampeek(unsigned int addr)
{
	DI
	outp(0x99, addr & 255);
	outp(0x99, (addr >> 8) & 0x3f);
	EI
	return inp(0x98);
}

void vrampoke(unsigned int addr, unsigned char byte)
{
	DI
	outp(0x99, addr & 255);
	outp(0x99, 0x40 | ((addr >> 8) & 0x3f));
	EI
	outp(0x98, byte);
}


static unsigned char vdpregs[] = {0x02,0x60,0x06,0xFF, 0x03, 0x36, 0x07,0x04};

void sc2()
{
	unsigned char r = 0;


	while (r> 3) * 8 + (y & 7) + (((unsigned int)(y & 248)) << 5);
	vrampoke (addr, vrampeek(addr) |  mask [(x & 7)] );
}


void plotpoints(unsigned int x, unsigned int y, unsigned int cx, unsigned int cy)
{
	setpixel((unsigned char)cx+x,(unsigned char)cy+y);
	setpixel((unsigned char)cx-x,(unsigned char)cy+y);
	setpixel((unsigned char)cx-x,(unsigned char)cy-y);
	setpixel((unsigned char)cx+x,(unsigned char)cy-y);

	setpixel((unsigned char)cx+y,(unsigned char)cy+x);
	setpixel((unsigned char)cx-y,(unsigned char)cy+x);
	setpixel((unsigned char)cx-y,(unsigned char)cy-x);
	setpixel((unsigned char)cx+y,(unsigned char)cy-x);

}


void circle(unsigned int cx, unsigned int cy, unsigned int radius)
{
	int x, y, d;
	x = 0; y = radius;
	d = 3 - 2*radius;
	while (x

the time should be taken from where the border color become white.

for z88dk substitute the include <sys.h> with <stdlib.h>

Par PingPong

Prophet (3889)

Portrait de PingPong

05-10-2008, 18:07

Pratically a similar test in pure MSX BASIC give rougly the same results of z88dk. However, i do not know how to optimize in z88dk.

Par PingPong

Prophet (3889)

Portrait de PingPong

05-10-2008, 18:14

would be a good idea to convert this program to pure Pascal. The compiler was created by Borland, and at the time they were very good optimizing compilers. Maybe we give us some surprise. Anyone want to try?

Par ARTRAG

Enlighted (6843)

Portrait de ARTRAG

03-09-2009, 14:35

Par Leo

Paragon (1236)

Portrait de Leo

03-09-2009, 15:04

hitech C is not too bad , when sdcc beats them all it is only by 15% , and when hitech c wins code is often by 50%.
ADC and z88 are in average slitghly behind.

Page 3/5
1 | 2 | | 4 | 5