No gents,
I simply can't leave it at that. I'm going to raise Peter's blood pressure one more time being after his scalp again.
In response to
my suggestion here, Peter went on insisting that
"The source code looks clean!"No Peter, it is not clean at all. It is just a classic specimen of bloody bloatware copied bluntly from somebody else's code not giving a damn what you were doing.
Change your While block in your scripts as follows:
while keydown(27)=0
for y=0 to 240
for x=0 to 320
c1 = sin(x / 50 + f + y / 200)
c2 = sqr((sin(0.8 * f) * 160-x+160) * (sin(0.8 * f) * 160-x+160) + (cos(1.2 * f) * 100-y+100) * (cos(1.2 * f) * 100-y+100))
c2 = sin(c2 / 50)
c3 = (c1 + c2) / 2
res = ((c3 + 1) * 127)
color r[res], g[res], b[res]
setpixel x, y
next
next
f = f+0.2
redraw
windowtitle = "FPS = " & getfps
wend
to be able to count your FPS and get your readings as you're
recalculating your sines and cosines again and again for nothing.
Now add two more vars to your declaration as follows:
single c1,c2,c3,f,sn,cs
and change your While block as follows:
while keydown(27)=0
for y=0 to 240
for x=0 to 320
sn = sin(.8 * f) * 160 - x + 160
cs = cos(1.2 * f) * 100 - y + 100
c1 = sin(x / 50 + f + y / 200)
c2 = sin(sqrt(sn * sn + cs * cs) / 50)
c3 = (c1 + c2) / 2
res = ((c3 + 1) * 127)
color r[res], g[res], b[res]
setpixel x, y
next
next
f = f+0.2
redraw
windowtitle = "FPS = " & getfps
wend
and watch your new FPS rate.
On my PC, I am getting a stable increase of
4FPS against the former 20FPS. This is
exactly 20% faster than your (OK let's call it "their") bloat!
And you're calling it clean? Well,
I wouldn't.
.