A few weeks ago while browsing YouTube for Fractal movies I came across a video that claimed to be (as of its post date of January 26, 2010) the deepest zoom movie on YouTube. The video was of an interesting area, but what really caught my eye was the information that the video took six months to render. Six months on twelve CPU cores.
I’ve worked pretty hard at optimizing Fractal eXtreme’s calculations so I decided to see how long it would take FX to render the exact same movie.
It took 18 hours. That’s 240 times faster.
I had expected FX to be faster, but 240 times faster was more than I had expected. So where did the speedups come from?
Different computers: The original render used three quad-core computers of 2009 vintage. I’m using a four-core eight-thread 2011 Sandybridge laptop CPU. Sandybridge is really fast, but my laptop CPU has a max clock speed that is a lot lower than on desktop parts, and the hyperthreads aren’t as powerful as real cores, and I’ve got fewer total threads. So, I suspect the total CPU power available is close to identical. FX speedup 1:1.
Interpolation: The original render calculated every frame, whereas Fractal eXtreme calculates key frames, separated by a magnification increase of 2.0. The original render ran at 30 frames per second for 312 seconds, for a total of 9,360 frames. Some of them are stationary frames at the beginning, but because the zoom speed drops at the end a higher percentage of the frames are towards the end where rendering takes longer, so the ratio of 9,360:916 is probably pretty reasonable and FX does about ten times less work. FX speedup: 10:1
Guessing: Despite its chaotic nature the Mandelbrot set has many large areas with a constant iteration count. Fractal eXtreme recognizes these and avoids calculating every pixel in these regions (it is very conservative in order to avoid errors). In extreme cases where there isn’t much detail this guessing can avoid calculating 90% or more of the pixels without changing the result. Overall the guessing reduced the workload by about two thirds. FX speedup: 3:1
Doubling magnification: Each Fractal eXtreme key frame is exactly double the magnification of the previous key frame. That means that one quarter of the pixels from key frame ‘n’ are also in key frame ‘n+1’. That means that Fractal eXtreme usually only has to calculate 75% of the pixels in a key frame, with no change in the final results. FX speedup: 4:3
Great programming: With 40:1 of the 240:1 advantage explained I think we are forced to conclude that Fractal eXtreme is just faster. The additional 6:1 advantage could come from using 64-bit math instead of 32-bit math (good for about a 4:1 advantage) plus using fully unwound math routines (good for perhaps a 1.5:1 advantage), but this is purely speculation. FX speedup: 6:1
Being able to calculate the same movie (same maximum iterations, depth, and target location) in 18 hours is nice, but we can do better. And, to be honest, when you interpolate key frames that have aliasing you do lose some quality. However if you antialias the key frames before interpolation then you actually get a higher quality movie, with more of the subtle detail visible, even after interpolation. And if you antialias and render at a higher resolution, you get an even higher quality movie. And, due to the nature of the Fractal eXtreme zoom movie interpolation system, you can play the movie back at a higher resolution than it was rendered and actually increase the quality even more.
Same location, same maximum iterations, slightly higher maximum zoom depth (to finish all the way into the final Mandelbrot set), 960×540 render resolution (up from 640×480), 3×3 antialiasing, and a final output resolution of 1280×720.
The higher resolution and antialiasing make a stunning improvement to the video quality. The moiré patterns and flickering pixels are gone, subtle ribbons of color are consistently visible even when they are less than a pixel wide, and the boundaries between bands are smooth. Because the interpolation is done after the time-consuming render it was possible to experiment with different zoom speeds, which allows the movie to go fast when there is little detail, and slow down whenever a mini-brot or other tourist attraction appears.
The increased resolution and antialiasing means that we need to render 15.1875 times more pixels, which would normally increase the render time to 11.4 days, plus a bit more for the two extra key frames at the end. However at higher resolutions the guessing works even better so this enhanced quality movie actually took less than 8 days of compute time.
The elapsed time was a bit higher than the render time because I was rendering this on my laptop, which I use for many other tasks. I left the render running when I was doing e-mail, web surfing, and writing this blog post (so FX was running a bit more slowly) but I had to pause it, and stop the clock, when I was taking the bus to work. If I’d done the calculations on a dedicated desktop machine like the one I have at work (six cores and higher frequencies) it could have been rendered in half the time.
8 days. 720p of antialiased Mandelbrot beauty. Thanks to Nosro for finding the location, and sharing its coordinates.
But enough talk. The proof is in the videos. Enjoy.
Original 640×480 non-antialiased zoom movie: