[Issue 4240] New: Array operations on short fixed-length arrays should be inlined

d-bugmail at puremagic.com d-bugmail at puremagic.com
Wed May 26 23:19:05 PDT 2010


http://d.puremagic.com/issues/show_bug.cgi?id=4240

           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
        AssignedTo: nobody at puremagic.com
        ReportedBy: clugdbug at yahoo.com.au


--- Comment #0 from Don <clugdbug at yahoo.com.au> 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
goal.

-- 
Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email
------- You are receiving this mail because: -------


More information about the Digitalmars-d-bugs mailing list