Scriba 681.86 seconds ?? scriptbasic.com
As they say, take this with a grain of salt!
Scriba BASIC interpreter
QuoteScriba 681.86 seconds ?? scriptbasic.com
Hi Ed,
Would you mind posting the Script BASIC code for your benchmark? I would like to try your code on Windows 7 as a 64 bit application. (not in the 32 bit emulator all the other tests were run under) Are there any other BASIC languages on your list able to run native 64 bit on your box?
I'm happy you added that disclaimer because your Script BASIC results are off by ~ 680 seconds.
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
print accum, " "
end if
count = count + 1
wend
print accum
@Mike - I didn't see a FBSL entry in Ed's list.
While having lots of neat things to offer, it is somewhat slow, compared to other interpreters
' ScriptBasic GFX - Mandelbrot
IMPORT gfx.inc
s = gfx::Window(640,480,"ScriptBasic GFX Mandelbrot")
ts = gfx::Time()
FOR y = 0 TO 479
FOR x = 0 TO 639
cx = (x - 320) / 120
cy = (y - 240) / 120
rit = gfx::Mandelbrot(cx, cy, 510)
gfx::PixelRGBA s, x, y, rit * 12, rit * 8, rit * 4, 255
NEXT
NEXT
te = gfx::Time()
gfx::stringColor s, 20, 15, "Time: " & FORMAT("%.4f",(te-ts)/1000) & " Seconds." & CHR(0), 0x000000ff
gfx::Update
WHILE gfx::KeyName(1) <> "+escape"
WEND
gfx::Close
I only see that output window flash and close :o
I look into allbasic forum and into scriptbasic forum and download latest release
but nothing ?
we're gonna get real old before we see you start your first SB test
@Aurel - PLEASE remove all traces of Script BASIC from your system. You are not qualified to use the language.
Declare Function GetCommandLine Lib "kernel32.dll" Alias "GetCommandLineA" () as String
#include <stdio.h>
#include "cbasic.h"
MAIN
BEGIN_FUNCTION
DIM AS 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;
accum = 0;
count = 0;
DEF_WHILE (count < 1545)
BEGIN_WHILE
left_edge = -420;
right_edge = 300;
top_edge = 300;
bottom_edge = -300;
x_step = 7;
y_step = 15;
max_iter = 200;
y0 = top_edge;
DEF_WHILE (y0 > bottom_edge)
BEGIN_WHILE
x0 = left_edge;
DEF_WHILE (x0 < right_edge)
BEGIN_WHILE
y = 0;
x = 0;
the_char = 32;
x_x = 0;
y_y = 0;
i = 0;
DEF_WHILE (i < max_iter AND x_x + y_y <= 800)
BEGIN_WHILE
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 MOD 300 EQ 0) THEN_DO PRINT ("%d\n", accum);
count = count + 1;
WEND
PRINT ("%d\n", accum);
RETURN_FUNCTION(0);
END_FUNCTION
Dropping the -O3 added more than a second to the time.
I'm impressed. Embedded C BASIC. :D
DECLARE SUB Mandel ALIAS "Int_Mandle_Bench" LIB "imb"
Mandel
/* The integer Mandelbrot bench
UXLIBS:
DWLIBS:
*/
#include <stdio.h>
#include "../../basext.h"
/**************************
Extension Module Functions
**************************/
besVERSION_NEGOTIATE
RETURN_FUNCTION((int)INTERFACE_VERSION);
besEND
besSUB_START
DIM AS long *p;
besMODULEPOINTER = besALLOC(sizeof(long));
IF (besMODULEPOINTER EQ NULL) THEN_DO RETURN_FUNCTION(0);
p = (long*)besMODULEPOINTER;
RETURN_FUNCTION(0);
besEND
besSUB_FINISH
DIM AS long *p;
p = (long*)besMODULEPOINTER;
IF (p EQ NULL) THEN_DO RETURN_FUNCTION(0);
RETURN_FUNCTION(0);
besEND
besFUNCTION(Int_Mandle_Bench)
DIM AS 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;
accum = 0;
count = 0;
DEF_WHILE (count < 1545)
BEGIN_WHILE
left_edge = -420;
right_edge = 300;
top_edge = 300;
bottom_edge = -300;
x_step = 7;
y_step = 15;
max_iter = 200;
y0 = top_edge;
DEF_WHILE (y0 > bottom_edge)
BEGIN_WHILE
x0 = left_edge;
DEF_WHILE (x0 < right_edge)
BEGIN_WHILE
y = 0;
x = 0;
the_char = 32;
x_x = 0;
y_y = 0;
i = 0;
DEF_WHILE (i < max_iter AND x_x + y_y <= 800)
BEGIN_WHILE
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 MOD 300 EQ 0) THEN_DO PRINT ("%d\n", accum);
count = count + 1;
WEND
PRINT ("%d\n", accum);
RETURN_FUNCTION(0);
besEND
#include <stdio.h>
#include <stdlib.h>
#include <getopt.h>
#include "scriba.h"
#include "cbasic.h"
MAIN
BEGIN_FUNCTION
DIM AS pSbProgram pProgram;
pProgram = scriba_new(malloc,free);
scriba_LoadConfiguration(pProgram, "/home/jrs/sb/sb22/bin/basic.conf");
scriba_SetFileName(pProgram, argv[1]);
scriba_LoadSourceProgram(pProgram);
scriba_Run(pProgram, argv[2]);
scriba_destroy(pProgram);
RETURN_FUNCTION(0);
END_FUNCTION
#include <stdio.h>
#include "cbasic.h"
MAIN
BEGIN_FUNCTION
DIM AS 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;
accum = 0;
count = 0;
DEF_WHILE (count < 1545)
BEGIN_WHILE
left_edge = -420;
right_edge = 300;
top_edge = 300;
bottom_edge = -300;
x_step = 7;
y_step = 15;
max_iter = 200;
y0 = top_edge;
DEF_WHILE (y0 > bottom_edge)
BEGIN_WHILE
x0 = left_edge;
DEF_WHILE (x0 < right_edge)
BEGIN_WHILE
y = 0;
x = 0;
the_char = 32;
x_x = 0;
y_y = 0;
i = 0;
DEF_WHILE (i < max_iter AND x_x + y_y <= 800)
BEGIN_WHILE
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 MOD 300 EQ 0) THEN_DO PRINT ("%d\n", accum);
count = count + 1;
WEND
PRINT ("%d\n", accum);
RETURN_FUNCTION(0);
END_FUNCTION
What is Koding?
Koding is an online development environment with the goal of simplifying worldwide development and providing free computation and development to everyone. It does this by offering Free VMs for development to anyone. The Koding VMs provide you with a real Ubuntu OS, with areal Terminal, and allow you to work on real code. Python,PHP, C++, C, it doesn’t matter. Even better, they are online. Accessible from anywhere in the world. Even sharable with teams.
Hi Ed,
Thanks for the PM with a copy of your benchmark for SB. Sorry to say it runs forever. (assumed - I gave up after 13 minutes) Maybe it's a 64 bit issue or something else. I will give it a try on my XP VirtualBox and see it runs there.
Change the main loop counter of 1545 to 15 ...