Hello,
I tried to transfer the Mandel test to plain basic. If I did it correctly, the code looks like this:
$ filename "Mandel2.exe"
includepath "$/inc/"
'#include "RTL32.inc"
'#include "RTL64.inc"
include "console.inc"
! GetTickCount lib "kernel32.dll" alias "GetTickCount" () as dword
sub main()
int left_edge, right_edge, top_edge, bottom_edge, max_iter,
x_step, y_step, y0, x0, x, y, i, x_x, y_y, temp, the_char,
accum, count
int t1,t2, time_lapsed
print "Starting Mandel accum:" + cr + cr
t1=GetTickCount()
accum = 0
count = 0
while count < 1545
left_edge = -420
right_edge = 300
top_edge = 300
bottom_edge = -300
x_step = 7
y_step = 15
max_iter = 200
y0 = top_edge
while y0 > bottom_edge
x0 = left_edge
while x0 < right_edge
y = 0
x = 0
the_char = asc(" ")
x_x = 0
y_y = 0
i = 0
while (i < max_iter) and (x_x + y_y <= 800)
x_x = (x * x) / 200
y_y = (y * y) / 200
if (x_x + y_y) > 800 then
the_char = asc("0") + i
if (i > 9) then
the_char = asc("@")
end if
else
temp = x_x - y_y + x0
if ((x < 0 and y > 0) or (x > 0 and y < 0)) then
y = (-1 * ((-1 * (x * y)) / 100)) + y0
else
y = x * y / 100 + y0
end if
x = temp
end if
i = i + 1
wend
accum = accum + the_char
x0 = x0 + x_step
wend
y0 = y0 - y_step
wend
if mod(count, 300) = 0 then
print accum + cr
end if
count = count + 1
wend
print accum
t2=GetTickCount()
time_lapsed = (t2-t1) / 1000 + cr
print cr + cr + "Time: " +time_lapsed + " Seconds" + cr + cr
print "Enter ..."
GetKey()
end sub
main()
The execution time with my notebook was 5 seconds for gcc, 19 seconds for Mandel_FBSL.exe and 23 seconds for Oxygenbasic. I did not try to optimize anything.
The result shows that my notebook is a lame box, as the test could be run 5 times faster. When I buy a new pc, I will have an usb-stick with this test program with me.
Roland