http://bitbucket.org/dfdeshom/gmp-java/src/
On Mar 25, 3:15 am, Matthew Kerle <mattke...@gmail.com> wrote:
> 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_s...>).
> 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
--
You received this message because you are subscribed to the Google Groups "The Java Posse" group.
To post to this group, send email to java...@googlegroups.com.
To unsubscribe from this group, send email to javaposse+...@googlegroups.com.
For more options, visit this group at http://groups.google.com/group/javaposse?hl=en.
enjoy,
John
On Mar 25, 4:15 am, Matthew Kerle <mattke...@gmail.com> wrote:
> 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_s...>).
> 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
From my experience down calls (Java -> Native) are very fast now (up
calls Native -> Java, not so much). However, most of my recent
experience is with a C-based messaging library (albeit a high
performance one), which would have a lower call frequency than the
rendering of a Mandelbrot set.
--
This is a very partial test which does not take into account what each
library can really do (floating point vs arbitrary precision,
including/not including transcendantal functions...)
http://tsusiatsoftware.net/
http://real-java.sourceforge.net/Real.html
http://dfp.sourceforge.net/
http://www.apfloat.org/apfloat_java/
Michaël
--