josecelano / mandelbrot-orbits-rust

Plotting Mandelbrot Set periods using Rust language.
MIT License
1 stars 0 forks source link

Use threads to improve the performace #9

Open josecelano opened 2 years ago

josecelano commented 2 years ago

In the book I'm following, there is an improvement by using threads:

https://github.com/ProgrammingRust/mandelbrot/tree/bands

There are different alternatives.

I would implement this once the image is generated correctly, or at least we merge this PR.

josecelano commented 2 years ago

Instead of parallelizing bands like in the book, we could use the "Mariani-Silver algorithm" as @jeremy-rifkin did here.

I've implemented the Mariani-Silver algorithm here, taking advantage of the fact that the mandelbrot is connected. We can compute all points on the edge of a box and if they're all the same then the entire square can be filled without spending compute time on the inside. If the edge is not uniform, the box is subdivided. This algorithm speeds things up drastically.