MandelbrotGenerator - a test application to multithreaded mandelbrot set generation
Main features:
- It uses the TTaskDispatcher to generate the resulting set.
- The calculation is multithreaded so that each (pixel) line is calculated in a separate task.
Here we make use of the property of the mandelbrot set that each pixel can be independently calculated. In our case multithreading the pixel calculation would be an overkill:
it would create too many superflous tasks (C++ objects) and definitely deteriorate the final result, due to relative time costs of the pixel value calculation and the task
coordination. As in the most cases of image processing, a succesful tradeoff solution is that we make line-based calculations (the time needed to generate a line is significantly (by an order of magnitude)
more than that needed for the task coordination).
- The configuration popup window allows for the user to set the number of processors and it shows the time needed for the whole calculation process.
- The user can zoom into the mandelbrot set with simply dragging the mouse.
- The backspace goes back to the previous zooming state.
Measurement results (on a large, fullscreen image):
Threads | Calc. time [msec]
|
1 | 265
|
2 | 140
|
3 | 94
|
4 | 63
|
As we can see, the calculation time linearly scales with the increasing number of processors.
The source code, with comments.
Download the test application.
Screenshots: