I have been working with Android native Linux recently and thought I would run Ed's
integer Mandelbrot benchmark on my Galaxy Tab 2 using
C BASICHere is the same
C BASIC program but running 64 bit on my Laptop.
jrs@laptop:~/C_BASIC/xlate$ time ./imandel
200574
60372774
120544974
180717174
240889374
301061574
309886830
real 0m2.028s
user 0m2.020s
sys 0m0.004s
jrs@laptop:~/C_BASIC/xlate$
#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
@Ed - You have Scriba (Script BASIC) noted as
Pure (direct text to execution) when in fact SB compiles/tokenized/PCode and syntax checks the program before execution starts. Scripts can be cached in their binary form for faster execution and load time.