BLA$ = ""
FOR i = 1 TO 50000
BLA$ &= "@"
NEXT
PRINT LEN(BLA$),"\n"
jrs@laptop:~/sb/sb22/test$ time scriba bench.sb
50000
real 0m0.133s
user 0m0.125s
sys 0m0.008s
jrs@laptop:~/sb/sb22/test$
Here is the new BaCon 3.3 version on my laptop.
BLA$ = ""
FOR i = 1 TO 50000
BLA$ = BLA$ & "@"
NEXT
PRINT LEN(BLA$),"\n"
jrs@laptop:~/BaCon/bacon-3.3$ bacon bench.bac
Converting 'bench.bac'... done, 7 lines were processed in 0.005 seconds.
Compiling 'bench.bac'... cc -c bench.bac.c
cc -o bench bench.bac.o -lbacon -lm
Done, program 'bench' ready.
jrs@laptop:~/BaCon/bacon-3.3$ time ./bench
50000
real 0m0.229s
user 0m0.220s
sys 0m0.004s
jrs@laptop:~/BaCon/bacon-3.3$ bacon -v
BaCon version 3.3 beta - (c) Peter van Eerten - MIT License.
jrs@laptop:~/BaCon/bacon-3.3$
You can try to make me look ridiculous, but you know d*** well you have modified the actual benchmark program (which is clearly mentioned in the above posts, multiple times).
And accidentally, with this change, all of a sudden your advertised ScriptBasic interpreter seems to be 'faster'.
Please abstain from deceptive posts like this and try to be clear and straight forward.
Thank you,
Peter
PS I am not using the 32-bit version as I am not using ScriptBasic at all - not for a long time, and for reasons you already know.
Making this comparison got me ban on the
BaCon forum but lets move on. James Fuller posted a BCX derivative which pre-dimensions a string and populates it with a
g_string_append_c() function call.
Peter,
Is this cheating Using my new UbxBasic and GStrings ?
James
$ONEXIT "~/UbxBasic/glib_build.sh $FILE$ -s"
$GLIB
Raw As GString Ptr gs
gs = g_string_sized_new(20001)
Dim i As Integer
For i = 1 To 200000
gs = g_string_append_c(gs,ASC("@"))
Next i
Print Right$(gs$->str,10)
james@james-DX4870:~/UbxBasic/examples/jcf/strwork$ time ./t02
@@@@@@@@@@
real 0m0.003s
user 0m0.000s
sys 0m0.000s
Here is the
Script BASIC equivalent.
PRINT LEN(STRING(20000,"@")),"\n"
jrs@laptop:~/sb/sb22/test$ time scriba jfstring.sb
20000
real 0m0.003s
user 0m0.000s
sys 0m0.003s
jrs@laptop:~/sb/sb22/test$
Keep in mind Script BASIC is an interpreter that must be loaded from disk and initialized before loading the script, parsing, tokenizing and running it. This all happens
before the string is being built which is the point of this benchmark. The compiled (optimized)
C example just focuses on appending a character to per dimensioned string.