Catching up with some new experiments.
@agraham I think the performance will be generally very nice for sprite based games. For heavy computation like demoscene it could be several times slower than orignial B4J, of course the interpreter is not made for this.
I am trying to remake the PICO-8
donut effect, where is the bottleneck to improve the speed? I am thinking maybe due to many string to number conversions in the interpreter?
I already made sin/cos tables, but I think those sin/cos calculations will not impact a lot.
[CODE lang="b4x" title="code"]
a = 1
b = 1
r1 = 1
r2 = 2
k1 = 80
k2 = 5
c1 = bx_rgb(0, 0, 0)
dim cosj(51)
dim sinj(51)
dim cosi(51)
dim sini(51)
for j = 0 to 50
cosj(j) = cos(j*0.12566)
sinj(j) = sin(j*0.12566)
sini(j) = sinj(j)
cosi(j) = cosj(j)
next
sub update
a = a + 0.00628
b = b + 0.00324
end sub
sub draw
bx_cls(c1)
ca = cos(a)
sa = sin(a)
cb = cos(b)
sb = sin(b)
for j = 0 to 50
ct = cosj(j)
st = sinj(j)
for i = 0 to 50
sp=sini(i)
cp=cosi(i)
ox=r2+r1*ct
oy=r1*st
sasp=sa*sp
oyca=oy*ca
x = ox*(cb*cp+sasp*sb)-oyca*sb
y = ox*(sb*cp-sasp*cb)+oyca*cb
k1oz= k1/(k2+ca*ox*sp+sa*oy)
xp=96+k1oz*x
yp=72-k1oz*y
l=cp*ct*sb-ca*ct*sp-sa*st+cb*(ca*st-ct*sasp)
ci = 128 + l*64
bx_pset(int(xp),int(yp),bx_rgb(ci,ci,ci))
next
next
end sub
[/CODE]