Hi Toro's Sieve test

BlitzMax Forums/BlitzMax Programming/Hi Toro's Sieve test

@JimB maybe you can validate that without much effort?
Sure thing. I entered a value of 1899 above which I just realised is the number of primes.

Anyhow, here's another run with more test results:
Interations     PureBasic     BMax Beta
       5000     1131 m/sec     477 m/sec
      10000     2344 m/sec     942 m/sec
      15000     3385 m/sec    2869 m/sec
      20000     4476 m/sec    3793 m/sec
      25000     5678 m/sec    4833 m/sec
      30000     6799 m/sec    5690 m/sec

The modified BMAX code I used (to show m/secs)
' Ported from another Basic for benchmarking purposes...
' Blitz Max version

Strict
Local t,Iter,Count,i,prime,k
'Global t,Iter,Count,i,prime,k

Const ITERATIONS = 5000

Local Flags [8191]
Print "SIEVE OF ERATOSTHENES - " + ITERATIONS + " iterations"

t = MilliSecs ()

For Iter = 1 To ITERATIONS

  Count = 0

  For I = 0 To 8190
    Flags[I] = 1
  Next

  For I = 0 To 8190
    If Flags[I]=1 Then
       Prime = I + I
       Prime = Prime + 3
       K = I + Prime
       While K <= 8190
         Flags[K] = 0
         K = K + Prime
       Wend
       Count = Count + 1
    EndIf
  Next

Next

t = MilliSecs () - t

Print (ITERATIONS)+" iterations took "+(t)+" m/secs."
Print "Primes: "+(Count)
End