Vincent Snijders wrote:
willem schreef:
In mandelbrot.pas the Calulatatepoint is used. If you remove this function then you can also gain speed.


I think I am missing something. How can you remove the calculatepoint? Of course it would speed up, because > 90% of the caclulations occur there. But these calculations are essential, aren't they?

Vincent
Vincent you are a good Free Pascal software engeneer, vecause yourprogram is good to understand. 1 IF we take the mandelbrot paramet N = 5000 then Calculatepoint will be called 25000000 times.
andCalculatePoint pushes x*Step - 1.5,Cy on the stack.
then it executes the statements of CalculatePoint
and finally it pops a boolean from the stack.

together that are 50000000 push and pops.
You can avoid that by making an inline statement of CalculatePoints.
So no function calls in the innerloops of mandelbrot.pas .

2 SSE2
sse is based on SIMD, single instruction multiple data (SIMD).
sse can multiply a 4*4 matrix with one multiply instruction.
In CalculatePoint there are 4 multiplications:
2*Zr*Zi
Zi*Zi
Zr*Zr

SSE2 can multiply these parameters in one instruction with the Mulps instruction. (multiply packed single).
But the parameters must be of single precision and not double precsion.
Single precision is 40 bits, I think it will not affect the outcome of the mandelbrot bitmap.
but 4 multiplications in 1 instruction will speed up the program.
we need only a 4*2 matrix  (a*b).
matrix a:
2*Zr*Zi*1
Zi*Zi*1*1
Zr*Zr*1*1
1*1*1*1
matrix b is the output.

Regards Wim




_________________________________________________________________
    To unsubscribe: mail [EMAIL PROTECTED] with
               "unsubscribe" as the Subject
  archives at http://www.lazarus.freepascal.org/mailarchives

Reply via email to