
One-Hour Mandelbrot: Creating a Fractal on the Vintage Xerox Alto - darwhy
http://www.righto.com/2017/06/one-hour-mandelbrot-creating-fractal-on.html
======
krylon
I still remember the day I read the article on the Mandelbrot set and went,
"Whoa, I understand the math!"

I went on to write my first Mandelbrot renderer in Python. I was delighted, in
a way, that it worked, but badly disappointed at the performance.

I rewrote the thing in C, and then rewrote it again to make use of multiple
CPU cores. I am certain there are Mandelbrot renderers out there that put mine
to shame. But still, it was fun, and I got some pretty desktop wallpapers out
of it. And I learned a thing or two along the way. Also, I rewrote it again
using PVM (Parallel Virtual Machine) to spread the work out across several
computers. So I actually learned two or three things along the way. ;-)

In a previous job, I had a supervisor who learned programming in the mid-80s
who told me about rendering the Mandelbrot set, then using bit-twiddling on
the VGA memory to change the color palette on the display. I was not sure if I
should be envious to have missed those times or happy.

~~~
dekhn
yeah, once z = z __2 + c was explained, most of Mandelbrot was easy for me
too.

I tried it in BASIC on an Apple IIe. it was the first time I was confronted
with the question of whether it was safe to run the computer over night, or if
it would overheat.

The next morning, the computer was fine, but it still hadn't reached an
interesting part of the set.

So once I got a PC I ended up using Fractint. In those days, Intels had slow
floating point, so they ported the algorithm to use integer. That was much
more effective than jjust speeding up the machine clock (my first learning
about performance).

Palette cycling was "cool" but by the time I got to college, while I thought
I'd spend all my time generating fractals, I found the real world more
interesting...

------
forinti
The first Mandelbrot generator I played with took more than 3 hours on a BBC
Micro to render a 160x256 image. That was 30 years ago and I still try out
variations on this from time to time (larger exponents, fractional exponents,
complex exponents, animations, etc).

[http://alquerubim.blogspot.com.br/search/label/Fractais](http://alquerubim.blogspot.com.br/search/label/Fractais)

~~~
waqf
… while in the same era Peitgen and Richter were publishing books with
detailed Mandelbrot sets in full-colour plates. What computers were _they_
using?

~~~
DanBC
They reference IBM labs. _The Beauty of Fractal Images_ talks about an IBM
4361-5 with extended precision, and an IBM 4250 printer for one of the
monochrome plates near the end of the book.

 _The Science of Fractal Images_ lists, as credits for the colour plates,
these people and institutions:
[http://imgur.com/a/KSnDZ](http://imgur.com/a/KSnDZ)

~~~
rbanffy
A cousin, the 4341, was my first mainframe. That was the first time I was
exposed to the concept behind pg's "beating the averages article": at a time
most of my colleagues were writing dBase or COBOL code, I interned with people
using Cincom's Mantis. It was the Rails of the 3270.

------
DaniFong
For anyone on iOS, I recommend you check out the app Frax. Created in part by
the Legendary Kai Krause!

[http://fract.al/](http://fract.al/)

Realtime, 60 fps, incredibly beautiful fractals on iPhone and iPad. (am not
affiliated with them, just a fan)

~~~
sp332
If you're not feeling so artistically inclined - or maybe just burned out on
the Mandelbrot set - you can get a "flame" fractal image or video every month
from a guy I know who does them professionally.
[https://www.patreon.com/QuinnPalmer](https://www.patreon.com/QuinnPalmer)

~~~
sp332
Super late edit - it's several wallpapers per month and one video. Also you
can get physical objects with the designs on them through his kinda-defunct
old site [http://fractal.world/](http://fractal.world/)

------
pasbesoin
Reminds me of writing programs to map the Mandelbrot and Julia sets onto the
display of my Kaypro 2X. Didn't even have real bitmapped graphics -- just a
way of packing... I think it was 4-pixel squares, into a character
representation and then writing that.

Similar to packing up bits to characters shot to some sort of dot matrix
printer attached to VAX, to print out such images, a couple of years earlier.
At least that generated the images more quickly.

The Kaypro 2X was long in the tooth, by that point.

I wonder whether it will still fire up?

~~~
cr0sh
There's a "mode" if you will, on CGA cards, that involves something similar -
best explained here:

[http://8088mph.blogspot.com/2015/04/cga-in-1024-colors-
new-m...](http://8088mph.blogspot.com/2015/04/cga-in-1024-colors-new-mode-
illustrated.html)

If this hasn't already been featured on HN, I'd be surprised...

------
1001101
"You can also see the CPU's registers on this board." That made me LOL a bit.
Very interesting architecture.

~~~
schoen
I've come to understand that many CPUs were not single-chip, well into the
integrated circuit era. Today we might assume that a microprocessor will come
in a single package, but that wasn't a reasonable assumption in other decades,
where the computer designer might even be creating the CPU as well, and not
have access to a semiconductor fab.

~~~
kens
It's surprising to me how in the 1970s, if someone needed a processor for
something (even a video game or CNC controller), it was normal for them to
invent a new instruction set and put together a processor from TTL chips. The
barrier to entry was very low.

~~~
edmccard
>...put together a processor from TTL chips. The barrier to entry was very
low.

It was mostly because of the clock speeds, wasn't it? I seem to remember once
hearing that below 20 Mhz you could play "TTL Lego" but above that you ran
into problems with things like propagation delay.

~~~
schoen
The stated propagation delay for TTL chips was usually about 10 or 20
nanoseconds (sometimes larger for more complex logical operations, and
frequently smaller in subsequent logic generations, like 5 nanoseconds or so).
I just checked this in a late 1970s databook.

So, 20 MHz seems pretty credible for a region where you would see problems due
to propagation delay—maybe even somewhere below that with the original 7400
series.

That's also a reason that I hadn't thought about so much why putting the whole
CPU on a single die would look more and more practical over time: propagation
delay in wires!

------
sp332
And now my crummy laptop can render a smooth-shaded version full-screen at 12
FPS.
[https://www.shadertoy.com/view/lsX3W4](https://www.shadertoy.com/view/lsX3W4)

~~~
Asooka
And it does that with a brute-force algorithm. Try xaos, it can render much
faster using ONLY THE CPU

------
andybest
I wonder if a more efficient microcode could be written for the Alto to
optimise just for rendering Mandelbrot sets

~~~
kens
The Alto has up to 3K RAM to hold custom microcode, and some programs used
their own microcode for performance. So, yes it would be quite possible to
speed up the Mandelbrot set with microcode. But writing Alto microcode is very
difficult, so I'm not planning to do that...

------
rbanffy
It wasn't much faster on the Apple II...

Even though its BASIC interpreter used a 40-bit float, that I was downsampling
the resolution to get 64-ish dithered colors, and that it was compiled down to
mostly ROM calls, it took a very long time to render regions, in special those
closer to the set itself.

Ok. As clock-efficient as the 6502 was, it still ran at 1 MHz.

------
DaniFong
An amazing demonstration of the math behind some fractals, which runs on web
gl, is Steven Witten's "How to Fold a Julia Fractal"

[https://acko.net/blog/how-to-fold-a-julia-
fractal/](https://acko.net/blog/how-to-fold-a-julia-fractal/)

Highly recommended

~~~
sdwisely
I recommend these too:

Coding Challenge #21: Mandelbrot Set with p5.js -
[https://www.youtube.com/watch?v=6z7GQewK-
Ks](https://www.youtube.com/watch?v=6z7GQewK-Ks)

VEX IN HOUDINI: MANDELBROT AND MANDELBULB -
[https://www.sidefx.com/tutorials/vex-in-houdini-
mandelbrot-a...](https://www.sidefx.com/tutorials/vex-in-houdini-mandelbrot-
and-mandelbulb/)

The second link is Houdini specific but you should be able to follow along
with the free version on win/linux/osx.

------
_Codemonkeyism
I remember writing Mandelbrot on C64 and Amigas. Depending on depth you could
wait some time. So it often was overnight, with a pleasunt suprise the next
morning (or some ugly looking picture)

------
TekMol

        On a modern computer, a Javascript program
        can generate the Mandelbrot set in a fraction
        of a second, while the Alto took an hour.
    

Hm... a "fraction" could mean anything. If it's exactly a second, then the
speedup factor would be about 3600x.

The Alto was built about 40 years ago, right? That would be 30% performance
improvement per year. Is that about right for single cpu performance
acceleration over the last 40 years?

~~~
kalleboo
Well with this[0] implementation[1] my laptop can render 3840x2400 pixels at
60fps, so ignoring the larger resolution, so how about 1/60th of a second?

[0]
[https://news.ycombinator.com/item?id=14588789](https://news.ycombinator.com/item?id=14588789)

[1] Is using a GPU cheating? Are we comparing computer performance or CPU
performance? The Alto didn't even have a CPU as we know it today...

~~~
TekMol
[1] Well, a GPU is somewhat geared towards this kind of workload. Both
comparisons (Alto to modern CPU and Alto to modern GPU) have some meaning.

------
karmakaze
With the limited computing power, they should have at least used the bilateral
symmetry to halve the time.

------
pjmlp
Nice, just a bit disappointed it was in BCPL and not Mesa.

~~~
kens
I'm working on getting Mesa and Smalltalk running on the Alto, so stay
tuned...

But BCPL is actually an interesting language. I knew that it influenced C (as
did Algol and other languages), but until using BCPL I didn't realize how much
of C was really the same as BCPL.

~~~
jacquesm
BCPL is almost a predecessor to C. The 8 bit micro that I used had a BCPL
compiler for it.

[http://www.computinghistory.org.uk/userdata/images/large/PRO...](http://www.computinghistory.org.uk/userdata/images/large/PRODPIC-9770.jpg)

That was a nice stepping stone to C on the Atari ST.

~~~
eschaton
It wasn't "almost" a predecessor to C, it was a direct predecessor.

~~~
pjmlp
There was B in between, which was Ken's attempt to a BCPL compiler, even the
language's manuals look quite similar.

