GLBasic forum

Codesnippets => Code Snippets => Topic started by: Qedo on 2011-Aug-23

Title: Old Mandelbrot test
Post by: Qedo on 2011-Aug-23
I found an old program of Mandelbrot written in  GlBasic and Blitx 3D and comparing the speed in pixels per second was disappointing:
150 Kpixel GLBasic  and 1000 Kpixel Blitx3D
I tried to understand why GlBasic was so slow and I found that the bottleneck was the command SETPIXEL.
I replaced it with the MEM2SPRITE and voila the program has jumped to 2000 Kpixel!!!
Great GLBasic  :good:
Ciao

[attachment deleted by admin]
Title: Re: Old Mandelbrot test
Post by: Moru on 2011-Aug-23
It looks like it is zooming into the Mandelbrot every frame. The black you see usually takes longer to compute than the colored areas because the loop has to run longer. So I would say the behaviour is expected.
Title: Re: Old Mandelbrot test
Post by: Qedo on 2011-Aug-23
In fact, with increasing zoom, the iterations of the loop increases to a maximum of Mmax (128)
Ciao
Code (glbasic) Select

WHILE (j < mMAX) AND (m < 4.0)
j=j+1
m = r * r - i * i
i = 2.0 * r * i + yval
r = m + xval
WEND
RETURN j / mMAX
Title: Re: Old Mandelbrot test
Post by: Kitty Hello on 2011-Aug-24
It's not using integers either, right? That example is veeeery old.
Title: Re: Old Mandelbrot test
Post by: Qedo on 2011-Aug-24
The program should be 8 years old
Surely with the use of integers should speed up but I was interested to see why it was so slow compared to the equivalent Blitz3D.
Blitz3D version also does not use the integer
Ciao
Title: Re: Old Mandelbrot test
Post by: bigsofty on 2011-Aug-24
MEM2SPRITE was a sneaky way to create a low level texture buffer, nice!  :D
Title: Re: Old Mandelbrot test
Post by: backslider on 2011-Aug-26
Is the original GLBasic example my code?  =D

By the way, nice!  :good: