|
Post by Tomaaz on Apr 10, 2022 14:42:49 GMT -6
Johnno, since other examples works on Linux, the problem is definitely not Linux. But who cares? 13 sec. to complete this task is not a good result for a compiler/transpiler/translator.
|
|
|
Post by rosy on Apr 10, 2022 14:46:31 GMT -6
You have to use a function in Python. At mine: RC - 40s Python3 - about 20 sec BasicC - 0.28 s #include <BasicSDL.h>
int start;
float endTime;
int n;
float r;
MAIN
start = SDLTime;
For (n,1,100000000)
Let(r,n*2-sin(88))
Next
endTime = SDLTime;
Let(endTime,(endTime - start) / 1000)
Print$ "completed in: " _ endTime $ " seconds" NL
ENDMAIN
|
|
|
Post by aurel on Apr 10, 2022 15:24:57 GMT -6
johnno can you show your RCbasic code
|
|
|
Post by johnno56 on Apr 10, 2022 22:32:42 GMT -6
'simple benchmark...o2bas 'Declare Function GetTickCount Lib "kernel32.dll" () As INT Dim start Dim endtime 'int n 'float r start = timer for n = 1 to 100000000 r = n*2-sin(88) next endTime = timer result = (endTime - start) / 1000 print "completed in: " + str(result) + " seconds" update()
|
|
|
Post by aurel on Apr 11, 2022 0:41:01 GMT -6
johnno that code in RCB do not show anything on my win7...v3.1.5 just console wich hangin there is no output window or message box or anything
|
|
|
Post by johnno56 on Apr 11, 2022 6:53:24 GMT -6
Sorry about that... I used the console to get the program to just run and print the results... Try this one... It's not pretty but it works... xmax = 640 ymax = 480 title$ = "" center_x = windowpos_centered center_y = windowpos_centered WindowOpen(1,title$,center_x,center_y,xmax,ymax,WindowMode(1,0,0,0,0),1) SetWindowAutoClose(1, 0) CanvasOpen(1,xmax,ymax,0,0,xmax,ymax,0) ClearCanvas
fnt = 1: loadFont(1, "arial.ttf", 18) 'simple benchmark...o2bas 'Declare Function GetTickCount Lib "kernel32.dll" () As INT Dim start Dim endtime
setColor(rgb(0, 160, 0)) start = timer DrawText("Start Time: " + str(start), 10, 10) update() for n = 1 to 100000000 r = n*2-sin(88) next endtime = timer setColor(rgb(255,25,0)) DrawText("End Time: " + str(endtime), 10, 30) update() result = (endtime - start) / 1000 setColor(rgb(255,128,0)) DrawText("Completed in ... " + str(result) + " seconds", 10, 60) if Not WindowExists(1) Or WindowEvent_Close(1) Then end end if update()
wait(5000) arial.ttf (358.5 KB)
|
|
|
Post by aurel on Apr 11, 2022 14:48:18 GMT -6
thanks johnno i tried with original 100 000 000 iteration and i simply cannot wait ...seems like stuck.. but with 10 000 000 it take 18 seconds on my machine so ..i think it was not that bad at all... but what Ed presnted on my forum is really man a interpreter killer 700 seconds oufff of course there are slower interpreters
|
|
|
Post by johnno56 on Apr 12, 2022 0:19:16 GMT -6
I tried running it with sdlbasic... 2014 edition... SDL1.2... yikes! It only got about 10-15 seconds into the program... and died... Why 2014? The only 64 bit Linux version of sdlbasic available... *sigh*
|
|
|
Post by aurel on Apr 12, 2022 14:54:59 GMT -6
well i don't tried with RC basic so i must see is this 700 seconds true .. i am not sure
|
|
|
Post by johnno56 on Apr 12, 2022 15:38:50 GMT -6
Just ran it on mine... Hope this helps...
|
|
|
Post by eddavis2 on Apr 12, 2022 18:01:16 GMT -6
.
|
|
|
Post by aurel on Apr 14, 2022 12:32:00 GMT -6
I tried to run this program with RCbasic seems that compile but nothing ran ? why is that ?
xmax = 640 ymax = 480 title$ = "" center_x = windowpos_centered center_y = windowpos_centered WindowOpen(1,title$,center_x,center_y,xmax,ymax,WindowMode(1,0,0,0,0),1) SetWindowAutoClose(1, 0) CanvasOpen(1,xmax,ymax,0,0,xmax,ymax,0) ClearCanvas fnt = 1: loadFont(1, "freemono.ttf", 18) 'simple benchmark...o2bas 'Declare Function GetTickCount Lib "kernel32.dll" () As INT Dim start Dim endtime setColor(rgb(0, 160, 0)) start = timer DrawText("Start Time: " + str(start), 10, 10) update()
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 = 32 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 = 48 + i if i > 9 then the_char = 64 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 count % 300 = 0 then DrawText("ACCUM: " + str(start), 10, 50) end if
count = count + 1 wend
DrawText("ACCUM: " + str(start), 10, 100)
endtime = timer setColor(rgb(255,25,0)) DrawText("End Time: " + str(endtime), 10, 150) update() result = (endtime - start) / 1000 setColor(rgb(255,128,0)) DrawText("Completed in ... " + str(result) + " seconds", 10, 200) if Not WindowExists(1) Or WindowEvent_Close(1) Then end end if update() wait(7000)
|
|
|
Post by johnno56 on Apr 14, 2022 19:09:50 GMT -6
Lines 43, 44, 53 and 55 use "\" (some Basic's use this to mean 'integer' division). My Linux version of RC did not like it... I changed them all to "/" and the error went away... (originally,mine would not compile, "Illegal character in line 43" etc
|
|
|
Post by aurel on Apr 15, 2022 6:13:14 GMT -6
I tried with 154 iterations and take 213 seconds on my win7 machine
xmax = 640 ymax = 480 title$ = "" center_x = windowpos_centered center_y = windowpos_centered WindowOpen(1,title$,center_x,center_y,xmax,ymax,WindowMode(1,0,0,0,0),1) SetWindowAutoClose(1, 0) CanvasOpen(1,xmax,ymax,0,0,xmax,ymax,0) ClearCanvas fnt = 1: loadFont(1, "freemono.ttf", 18) 'simple benchmark...o2bas 'Declare Function GetTickCount Lib "kernel32.dll" () As INT Dim start Dim endtime setColor(rgb(0, 160, 0)) start = timer DrawText("Start Time: " + str(start), 10, 10) update() dim accum dim count dim left_edge dim right_edge dim top_edge dim bottom_edge dim x_step dim y_step dim max_iter dim x dim y dim x0 dim y0 dim x_x dim y_y dim temp dim the_char
accum = 0 count = 0 while count < 154 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 = 32 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 = 48 + i if i > 9 then the_char = 64 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 count / 300 = 0 then DrawText("ACCUM: " + str(start), 10, 50) end if
count = count + 1 wend
DrawText("ACCUM: " + str(start), 10, 100)
endtime = timer setColor(rgb(255,25,0)) DrawText("End Time: " + str(endtime), 10, 150) update() result = (endtime - start) / 1000 setColor(rgb(255,128,0)) DrawText("Completed in ... " + str(result) + " seconds", 10, 200) if Not WindowExists(1) Or WindowEvent_Close(1) Then end end if update() wait(7000)
|
|
|
Post by tbird on Apr 15, 2022 9:31:19 GMT -6
I got 31.2 seconds on my laptop Win11, i7-9750h laptop.
|
|