Mandelbrot Benchmarking
Mandelbrot Benchmarking
I decided to update my old Mandelbrot benchmark to the one I used recently (originally in VTL) to check my TinyBasic, then on a whim, I decided to make it work on the other BASICs I had to-hand.
It should work on most retro/8-bit BASIC systems with minimal changes and work over 16-bit signed integer BASICs to 4 or 5 byte floating point ones.
I put it all here:
https://projects.drogon.net/retro-basic ... andelbrot/
Cheers,
-Gordon
It should work on most retro/8-bit BASIC systems with minimal changes and work over 16-bit signed integer BASICs to 4 or 5 byte floating point ones.
I put it all here:
https://projects.drogon.net/retro-basic ... andelbrot/
Cheers,
-Gordon
--
Gordon Henderson.
See my Ruby 6502 and 65816 SBC projects here: https://projects.drogon.net/ruby/
Gordon Henderson.
See my Ruby 6502 and 65816 SBC projects here: https://projects.drogon.net/ruby/
Re: Mandelbrot Benchmarking
Nice thanks for sharing it - I'm thinking of following your lead and porting BBC BASIC to my system, then maybe I can give it a go!
Re: Mandelbrot Benchmarking
Nice - thanks for writing up and sharing!
I wonder if there's something funny going on - I'm not 100% happy about the integer-mode output. Of course the problem might be my expectations!
Here's an owlet link for the Beeb running Basic 2
And here's the same thing but using integer arithmetic.
(In both cases, press the rocket button for a quick run.)
I'm suspicious of the shapes of the contours - posting this with a vague idea I might look into it tomorrow.
I wonder if there's something funny going on - I'm not 100% happy about the integer-mode output. Of course the problem might be my expectations!
Here's an owlet link for the Beeb running Basic 2
And here's the same thing but using integer arithmetic.
(In both cases, press the rocket button for a quick run.)
I'm suspicious of the shapes of the contours - posting this with a vague idea I might look into it tomorrow.
Re: Mandelbrot Benchmarking
BigEd wrote:
I'm suspicious of the shapes of the contours - posting this with a vague idea I might look into it tomorrow.
Thanks,
-Gordon
--
Gordon Henderson.
See my Ruby 6502 and 65816 SBC projects here: https://projects.drogon.net/ruby/
Gordon Henderson.
See my Ruby 6502 and 65816 SBC projects here: https://projects.drogon.net/ruby/
Re: Mandelbrot Benchmarking
BigEd wrote:
Nice - thanks for writing up and sharing!
I wonder if there's something funny going on - I'm not 100% happy about the integer-mode output. Of course the problem might be my expectations!
...
I'm suspicious of the shapes of the contours - posting this with a vague idea I might look into it tomorrow.
I wonder if there's something funny going on - I'm not 100% happy about the integer-mode output. Of course the problem might be my expectations!
...
I'm suspicious of the shapes of the contours - posting this with a vague idea I might look into it tomorrow.
The real problem however is with the bounds check on lines 230-240:
Code: Select all
230A%=T%: P%=A%/F%:Q%=B%/F%
240IF ((P%*P%)+(Q%*Q%))>=5 GOTO 280
Code: Select all
230A%=T%
240IF ((A%*A% DIV F%)+(B%*B% DIV F%))>=5*F% GOTO 280
It seems to work pretty well:
https://bbcmic.ro/#%7B%22v%22%3A1%2C%22 ... %5Cn%22%7D
Re: Mandelbrot Benchmarking
Oh, well done, that does look a lot better!
Re: Mandelbrot Benchmarking
BigEd wrote:
Oh, well done, that does look a lot better!
-Gordon
--
Gordon Henderson.
See my Ruby 6502 and 65816 SBC projects here: https://projects.drogon.net/ruby/
Gordon Henderson.
See my Ruby 6502 and 65816 SBC projects here: https://projects.drogon.net/ruby/
Re: Mandelbrot Benchmarking
Yes... it does seem to make it a bit more difficult to experiment with the implications of different word sizes.
- barrym95838
- Posts: 2056
- Joined: 30 Jun 2013
- Location: Sacramento, CA, USA
Re: Mandelbrot Benchmarking
gfoot wrote:
The real problem however is with the bounds check on lines 230-240:
P% and Q% suffer badly from rounding here, as you're dividing by the fixed point factor. You can use floating point for P and Q, or better, do the comparison in the fixed point space:
This may suffer different problems if it ends up overflowing the maximum integer width - 16 bits is pretty narrow - I haven't thought much about what the worst-case inputs would be though!
Code: Select all
230A%=T%: P%=A%/F%:Q%=B%/F%
240IF ((P%*P%)+(Q%*Q%))>=5 GOTO 280
Code: Select all
230A%=T%
240IF ((A%*A% DIV F%)+(B%*B% DIV F%))>=5*F% GOTO 280
Code: Select all
100 REM PR#3 FROM > PROMPT FIRST!
105 PRINT "MANDELBROT - WOZ BASIC"
110 PRINT "START"
130 DIM Z$(17):Z$=".:,;-=+^/%&S$X#@ "
140 F=50
150 FOR Y=-12 TO 12
160 FOR X=-49 TO 29
170 C=X*229/100
180 D=Y*416/100
190 A=C:B=D:I=1
200 Q=B/F:S=B-Q*F
210 T=(A*A-B*B)/F+C
220 B=2*(A*Q+A*S/F)+D
230 A=T:P=A/F:Q=B/F
240 IF P*P+Q*Q>4 THEN 280
250 I=I+1: IF I<17 THEN 200
280 PRINT Z$(I,I);: NEXT X
300 PRINT : NEXT Y
330 PRINT "FINISHED";
350 ENDCode: Select all
100 REM PR#3 FROM ] PROMPT FIRST!
105 PRINT "MANDELBROT - APPLESOFT"
110 PRINT "START"
130 Z$ = ".:,;-=+^/%&S$X#@ "
140 F = 50
150 FOR Y = - 12 TO 12
160 FOR X = - 49 TO 29
170 C = X * 229 / 100
180 D = Y * 416 / 100
190 A = C:B = D:I = 1
200 Q = B / F:S = B - Q * F
210 T = (A * A - B * B) / F + C
220 B = 2 * (A * Q + A * S / F) + D
230 A = T:P = A / F:Q = B / F
240 IF P * P + Q * Q > 4 THEN 280
250 I = I + 1: IF I < 17 THEN 200
280 PRINT MID$ (Z$,I,1);: NEXT X
300 PRINT : NEXT Y
330 PRINT "FINISHED";
350 END Got a kilobyte lying fallow in your 65xx's memory map? Sprinkle some VTL02C on it and see how it grows on you!
Mike B. (about me) (learning how to github)
Mike B. (about me) (learning how to github)
-
GlennSmith
- Posts: 162
- Joined: 26 Dec 2002
- Location: Occitanie, France
Re: Mandelbrot Benchmarking
Hi,
I was looking for something simple to try out with my rather cumbersome (*) but all the same operational PLASMA Virtual Machine running on the Pico6502. I chose to adapt the Apple][ version that appears above. So the code becomes
[edit] BTW "word" in PLASMA means a 16-bit object.
... which shows a part of the PLASMA vocabulary. If I run the code through the linux VM, it gives this picture
If I run it through the 6502 VM, I get this picture
(*) I can't give any timing for the moment, because the "Pico6502" VM is, in fact, the linux version pushed through cc65 - with stdio and all the rest of it - and it spends 80% of it's time messing around with the C stack and only 20% doing any real work. More news soon on a more "native" 6502 version.
I was looking for something simple to try out with my rather cumbersome (*) but all the same operational PLASMA Virtual Machine running on the Pico6502. I chose to adapt the Apple][ version that appears above. So the code becomes
[edit] BTW "word" in PLASMA means a 16-bit object.
Code: Select all
byte[] Z = ".:,;-=+^/%&S$X#@ "
word A, B, C, D, E, F, I, P, Q, S, T, X, Y
F = 50
for Y = -12 to 12
for X = -49 to 29
C = X * 229 / 100
D = Y * 416 / 100
A = C; B = D; I = 1
repeat
Q = B / F; S = B - Q * F
T = (A * A - B * B) / F + C
B = 2 * (A * Q + A * S / F) + D
A = T; P = A / F; Q = B / F
if (P * P + Q * Q) > 4 break
fin
I++
until I >= 17
putc(Z[I])
next
putln
next
puts("FINISHED\n")
done
Code: Select all
......::::::::::::::::::::::,,,,,,,,,;;;;;-=+/S$+^--;;,,,,,,:::::::::::........
.......:::::::::::::::::::::,,,,,,,,,;;;--=%/$ ^^%-;;;;,,,,,:::::::::.........
........::::::::::::::::,,,,,,,,;;;,----==+ %==-;;;;,,:::::::::..........
........:::::::::::,::::,,,,,,,;;;-==++=^^/ %^+==----,,,,::::::..........
.....::::::::::::,,,,,,,,;;;;;;;--=^ &S% ^/^S=-;,::::::::::.......
...:::::::::::,,,,,,,,,,;;;;;;---++^ =;,,,,:::::::::.....
....:::::::::::,,,;;;---------===& %+--;;,,,:::::::......
.....::::::,,,,,,;;-=X++=^ +===+^% &&-;;,,,:::::::......
....::,,,,,,,,;;;;-=+% /$ #/^/% S-;;,,::::::::......
::::::,,,,,,;;;;;-==^/X # -;;,,,::::::::::::.
:::::,,,;;;;-----^/%& =-;;,,:::::::::::::.
::::,,;;--====+=/& $+-;;,,,,,,::::::::::.
::::, %^=--;;,,,,:::::::::::.
::::,,;;--====+=/& $+-;;,,,,,,::::::::::.
:::::,,,;;;;-----^/%& =-;;,,:::::::::::::.
::::::,,,,,,;;;;;-==^/X # -;;,,,::::::::::::.
....::,,,,,,,,;;;;-=+% /$ #/^/% S-;;,,::::::::......
.....::::::,,,,,,;;-=X++=^ +===+^% &&-;;,,,:::::::......
....:::::::::::,,,;;;---------===& %+--;;,,,:::::::......
...:::::::::::,,,,,,,,,,;;;;;;---++^ =;,,,,:::::::::.....
.....::::::::::::,,,,,,,,;;;;;;;--=^ &S% ^/^S=-;,::::::::::.......
........:::::::::::,::::,,,,,,,;;;-==++=^^/ %^+==----,,,,::::::..........
........::::::::::::::::,,,,,,,,;;;,----==+ %==-;;;;,,:::::::::..........
.......:::::::::::::::::::::,,,,,,,,,;;;--=%/$ ^^%-;;;;,,,,,:::::::::.........
......::::::::::::::::::::::,,,,,,,,,;;;;;-=+/S$+^--;;,,,,,,:::::::::::........
FINISHED
Glenn-in-France
-
GlennSmith
- Posts: 162
- Joined: 26 Dec 2002
- Location: Occitanie, France
Re: Mandelbrot Benchmarking
Hi all,
I have now successfully ported the PLASMA VM to the RP6502 "Picocomputer" in native ASM + Plasma.
It's probably because you're all so far away that I couldn't hear all of the "HOURRAA"s
Anyway, the above code completes in the native VM (bytecode interpreter) in 21.73 seconds. The 65C02 is being clocked at 7.5MHz, 'cos I'm getting fileIO errors at 8MHz. *AND* I had to cheat with the timing, the API entry for reading clock ticks doesn't work currently...
Have a great Sunday y'all.
I have now successfully ported the PLASMA VM to the RP6502 "Picocomputer" in native ASM + Plasma.
It's probably because you're all so far away that I couldn't hear all of the "HOURRAA"s
Anyway, the above code completes in the native VM (bytecode interpreter) in 21.73 seconds. The 65C02 is being clocked at 7.5MHz, 'cos I'm getting fileIO errors at 8MHz. *AND* I had to cheat with the timing, the API entry for reading clock ticks doesn't work currently...
Have a great Sunday y'all.
Glenn-in-France
Re: Mandelbrot Benchmarking
Hurrah!
Re: Mandelbrot Benchmarking
Hurrah! Can't wait to see what the hybrid VM will do
-
GlennSmith
- Posts: 162
- Joined: 26 Dec 2002
- Location: Occitanie, France
Re: Mandelbrot Benchmarking
resman wrote:
Hurrah! Can't wait to see what the hybrid VM will do
Glenn-in-France
Re: Mandelbrot Benchmarking
GlennSmith wrote:
resman wrote:
Hurrah! Can't wait to see what the hybrid VM will do