Interesting speed test

BlitzMax Forums/BlitzMax Programming/Interesting speed test

Ok bare in mind that Im rubbish at C++, but I had a go anyway, just Method1
#include "DarkGDK.h" 


int time1;

bool LinesCollide (int x1,int y1, int x2, int y2, int x3,int y3,int x4,int y4)
{
	int dpx = x3 - x1 + x4 - x2;
	int dpy= y3 - y1 + y4 - y2;
	int qax= x2 - x1;
	int qay= y2 - y1;
	int qbx= x4 - x3;
	int qby= y4 - y3;
	
	int d= qay*qbx - qby*qax;
	int la = qbx*dpy - qby*dpx;
	int lb = qax*dpy - qay*dpx;
	
	if (dbABS (float (la))<=dbABS(float (d)) && dbABS(float (lb))<=dbABS(float (d))) return true;
	
	return false;
}


void DarkGDK ( void )
{ 
	dbRandomize (dbTimer());
	dbSyncOn ( );
	dbSync();
	
	int TheArray [500000][8] = {0};
	
	for (int g = 0;g<6;g++)
	{
		int Count1 = 0;
	
		for(int i = 0; i < 500000; i++)
		{
			TheArray [i][0]=dbRND ( 799 ) ;
			TheArray [i][1]=dbRND ( 599 ) ;
			TheArray [i][2]=dbRND ( 799 ) ;
			TheArray [i][3]=dbRND ( 599 ) ;
			TheArray [i][4]=dbRND ( 799 ) ;
			TheArray [i][5]=dbRND ( 599 ) ;
			TheArray [i][6]=dbRND ( 799 ) ;
			TheArray [i][7]=dbRND ( 599 ) ;
		}

	
		dbWait (20);
		time1=dbTimer();	
		for(int i = 1; i < 500000; i++)
		{
			if (LinesCollide (TheArray [i-1][0],TheArray [i-1][1],TheArray [i-1][2],TheArray [i-1][3],TheArray [i-1][4],TheArray [i-1][5],TheArray [i-1][6],TheArray [i-1][7])) Count1++;
		}
		time1 = dbTimer()-time1;
		dbText (10,20*g,dbStr(Count1));
		dbText (90,20*g,dbStr(time1));
		dbSync ();
	}
		dbWaitKey ();
}

Note 1: As you may be able to tell, its using DarkGDK, and The free VC8 express. And possibly someone who know what they are doing could improve it.
Note 2:I got it going with a Low Array size, and then it stopped working with the larger size. Ok so it was just nessesary to increase the Stack size, but Ive never had to do anything like that with BMax
Note 3:I dont think that I compiled it as Managed C++, and am almost certain that I ran it as core C++

DeBug
116109     211
115805     223
115598     198
115891     199
115433     199
115914     204
Max, 271,274,276,270,269

Release
115598     161
115878     156
116235     159
116088     157
115766     157
115657     158
Max, 70,65,65,65,64

I dont think Ive made the code any differently in the C version, but if anyone want to point out a bottleneck Ive introduced please do.