MAX v Blitz2D: Speed

BlitzMax Forums/BlitzMax Beginners Area/MAX v Blitz2D: Speed

The forum is locked. These are the original blitzbasic.com forums, kept so they can still be read. No new topics, replies or edits can be made here. To join in, head over to the Blitz3D+ forums.

Some tests you can try for yourself ...


This zip includes source + exe for BlitzMax , Blitz3D, C++, and Pure Basic.

Sieve Speed Tests

Anyone fancy doing other versions such as C++ (source+exe) ?

Here's the Max code
' BlitzMax sieve test

Framework BRL.StandardIO
Import BRL.System

Const ITERATIONS=50000

Print("SIEVE OF ERATOSTHENES - "+ITERATIONS+" iterations")

Global t=MilliSecs()

For Local Iter = 1 To ITERATIONS

	Local flags[8191],i,k,prime
	Local Count = 0

	For i = 0 To 8190
    	flags[i] = 1
	Next

	For i = 0 To 8190
		If flags[i]=1
			prime=i+i
			prime=prime+3
			k=i+prime
			While k <= 8190
				flags[k] = 0
				k=k+prime
			Wend
			count=count+1
		EndIf
	Next

	FlushMem

Next

t=MilliSecs()-t
Print ITERATIONS+" iterations took "+t+" m/secs."
Print "Primes: "+Count
Input "Return to end ..."
End