Summary: Array operations on short fixed-length arrays should
                    be inlined
           Product: D
           Version: 1.020
          Platform: Other
        OS/Version: Windows
            Status: NEW
          Keywords: performance
          Severity: normal
          Priority: P2
         Component: DMD

--- Comment #0 from Don <> 2010-05-26 23:19:03 PDT ---
If an array operation is performed on a short fixed-length array, for example:

float[3] x,y;
x[] += y[] * 4.0;

then it should not become a function call, it should simply be turned into:

x[0] += y[0] * 4.0;
x[1] += y[1] * 4.0;
x[2] += y[2] * 4.0;

I suspect that the threshold for making the function call will be occur at
length at least 9, possibly higher, since the overhead for the function call is
very large (it needs to check the capabilities of the processor, for example).

This will allow array operations to provide good performance in the
commonly-used case of 2D, 3D and 4D vectors.

For x86, when the code generator supports it, such usage should be turned
directly into SSE instructions. This issue is a step towards that longer-term

Configure issuemail:
------- You are receiving this mail because: -------

Reply via email to