It's the other way aroundLuCiFeR[SD] wrote:I have a honda... so I must have a small, erm, thing lol

You have to change the Blitzmax-Code to:LuCiFeR[SD] wrote:va!n: The code posted by you compiles to 820 KB (839,680 bytes). The only reason I know this is cause I bought BlitzMax... Although I have yet to even write one line of code in it LOL.
Code: Select all
Framework BRL.StandardIO
Import BRL.System
Const ITERATIONS = 10000
Local Flags [8191]
Print "SIEVE OF ERATOSTHENES - " + ITERATIONS + " iterations"
X = 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
X = MilliSecs () - X
Print "1000 iterations took "+(X/1000.0)+" seconds."
Print "Primes: "+Count
End
Then it compiles down to 43 KB (with upx 19 KB) - not too bad. On my machine the blitzmax-code above runs in 0.889999986 seconds. The posted PB-Code (with 10000 iterations) needs 2.625000 seconds.
Code: Select all
PureBasic 7.168 bytes vs BlitzMax 43.520 bytes (44.032 bytes with added Input() @ EOF *g*)
PureBasic 2.780000 vs BlitzMax 0.916000009
Code: Select all
Changed BlitzMax using framework and imports for small size by perb:
Framework BRL.StandardIO
Import BRL.System
Const ITERATIONS = 10000
Local Flags [8191]
Print "SIEVE OF ERATOSTHENES - " + ITERATIONS + " iterations"
X = 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
X = MilliSecs () - X
Print "1000 iterations took "+(X/1000.0)+" seconds."
Print "Primes: "+Count
End
Code: Select all
BlitzMax to PB converted source by thefool:
OpenConsole()
#ITERATIONS = 1000
Dim Flags(8191)
PrintN ("SIEVE OF ERATOSTHENES - " + Str(#ITERATIONS) + " iterations")
X.f = GetTickCount_()
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
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
X.f = GetTickCount_() - X.f
PrintN ("1000 iterations took "+StrF((X.f/1000))+" seconds.")
PrintN( "Primes: "+Str(Count))
Input()
mhhh... its 0.9 and 2.7Shannara wrote:Um, according to your test, PB wins, not BlitzMax since .9 is longer then .2.
Well, there ya go... I didn't know that. Cheers perb, learn something new every dayperb wrote:You have to change the Blitzmax-Code to:LuCiFeR[SD] wrote:va!n: The code posted by you compiles to 820 KB (839,680 bytes). The only reason I know this is cause I bought BlitzMax... Although I have yet to even write one line of code in it LOL.
Code: Select all
Framework BRL.StandardIO <SNIP>
@Dare2:Dare2 wrote:Succumbed to temptation, DLed and had a quick look.
It has some really potent options!
Is this true or did my quick look in the docs miss something:
.. No ability to use a dll? (Or make one?)
.. Console only, no windows?
However there is some really nice stuff in there, esp (obviously) for graphics, and also for using other lang sources! (But really no dll access? - puzzled!)