TL;DR we're writing a Mandelbrot set viewer and need to dive deeper.
BigDecimal sucks. help!

So... My friend wrote a mandelbrot set viewer in Java (with Netbeans =D )
using floats, it's pretty nice and lets you pan around and zoom and the
performance is not too bad, but after a while you hit the precision limit of
float (image pixellates out) so we swapped over to double and got a bit
deeper.

The problem is now we want to go deeper than double lets us (step 6
here<http://en.wikipedia.org/wiki/Mandelbrot_set#Image_gallery_of_a_zoom_sequence>).
We tried implementing with BigDecimal but the performance absolutely crapped
out, like 100x worse, you die waiting for a single frame to render even with
precision turned way down (God help if you don't set a MathContext!!). After
googling around it looks like the problem is BigDecimal, it's optimised for
precision over speed. we don't care very much about precision, we just need
enough to get our pretty colours :-) Speed is more of a concern, although
obviously we're not realistically expecting float/double type speed from
arbitrary-precision arithmetic, but a slowdown of 2-5x would be fine, 10x +
starts getting depressing though...

Other methods of performance tuning we're looking at:
- firstly progressive rendering (eg, do 100 iterations, draw an image, then
next 100 and so on to limit)
- scale-dependant implementation (eg go from float to double to ? as you
zoom in)
- multi-threading (split the image up and hand each portion off to a core,
not sure best way to configure this, thread per core?)
- caching (not sure best strategy for this, store result for each point with
iteration count or image directly? cache would get HUGE, but don't care...)

I've found the ApFloat library <http://www.apfloat.org/apfloat_java/> which
looks pretty cool. but haven't had a chance to run some comparison runs with
it against BD yet (darn day job!!).

Just wondering if anyone else has any experience with this domain or any
pointers? it's been a few years since uni and my number theory is a bit
rusty (one of the reasons we're playing with this...). mandelbrot uses
T(n+1) = n^2 + first term, so maybe we can do some optimisations by using
operating on integers and storing the precision separately? (obviously this
is what BD does already, but we only want a narrow slice of what it does...)

incidentally, found Fast Fractal, it's a closed-source
windows-only<http://www.fastfractal.com/>program which purports to
have GPU acceleration for fractal viewing. I tried
it out and wasn't impressed, but then it couldn't detect my graphics card so
GPU acceleration wasn't enabled (low-rung Toshiba Satellite laptop). Any
decent GPU accelerated mandelbrot viewers out there for linux?

cheers!
matt.

-- 
You received this message because you are subscribed to the Google Groups "The 
Java Posse" group.
To post to this group, send email to [email protected].
To unsubscribe from this group, send email to 
[email protected].
For more options, visit this group at 
http://groups.google.com/group/javaposse?hl=en.

Reply via email to