Blitz
execution : 8004 ms
size exe: 1 290 240 octets
PureBasic
execution : 7656 ms
size exe: 6144 octets
C/C++
execution : 31 ms
size exe : 45 056 octets
Here are the source codes
Code: Select all
;blitz basic
StartTime=MilliSecs()
y#=123456789
j=1
t=0
u=0
For i=1 To 10000000
If j=1 Then j=2
If j=2 Then j=4 Else j=1
t=t+256
u=u-256
y#=y#+y#/3
Next
Print MilliSecs()-StartTime
Delay(2000)
Code: Select all
; PureBasic
OpenConsole()
StartTime=ElapsedMilliseconds()
y.f=123456789
j=1
t=0
u=0
For i=1 To 10000000
If j=1
j=2
EndIf
If j=2
j=4
Else
j=1
EndIf
t=t+256
u=u-256
y.f=y.f+y.f/3
Next i
ElapsedTime = ElapsedMilliseconds()-StartTime
Print (Str(ElapsedTime))
Delay(2000)
Code: Select all
#include "stdafx.h"
#include "math.h"
#include "time.h"
#include "stdio.h"
int _tmain(int argc, _TCHAR* argv[])
{
int i=0,j=1,x=0,u=0,t=0;
int StartTime=clock();
double y=123456789;
for (i=1;i<10000000;i++)
{
if (j==1) j=2;
if (j==2) j=4; else j=1;
t=t+256;
u=u-256;
y=y+y/3;
}
x=clock()-StartTime;
printf("time=%d", x);
getchar();
return 0;
}