Re: [cc65] Benchmarks

From: Markus Stehr <bastetfurry1ircnet.de>
Date: 2009-09-03 17:22:14
Hi!

Something very simple, just adding up longs:

--------------------------<PUT CHAINSAW HERE>---------------------
#include <stdio.h>
#include <time.h>

void main(void)
{
	unsigned long a,b;
	unsigned int i,j;
	clock_t starttime,endtime;

	starttime = clock();
	// Bench starts here
	for(i=0;i<500;++i)
	{
		//printf("i:%d\n",i);
		a = 2;
		b = 1;
		for(j=0;j<20;++j)
		{
			b = b + a;
			a = b;
			//printf("j:%d a:%ld\n",j,a);
		}
	}
	// Bench ends here
	endtime = clock();

	printf("Time in system ticks:%ld\n",endtime-starttime);
	printf("Time in seconds:%ld\n",(endtime-starttime)/CLOCKS_PER_SEC);
}
--------------------------<PUT CHAINSAW HERE>---------------------

Hope it helps :)

My results:
Compiler:
bastetfurry@katzenrechner:~/projekte$ cc65 --version
cc65 V2.12.9
cc65: No input files

Results on a C64 (VICE):
Time in system ticks:371
Time in seconds:6

And for the records, GCC4.3.3 whines about main not being int. ;)

Greets,
Markus

----------------------------------------------------------------------
To unsubscribe from the list send mail to majordomo@musoftware.de with
the string "unsubscribe cc65" in the body(!) of the mail.
Received on Thu Sep 3 17:22:24 2009

This archive was generated by hypermail 2.1.8 : 2009-09-03 17:22:26 CEST