[Issue 10085] New: Inefficient codegen for initialisation and	variadic arguments
    d-bugmail at puremagic.com 
    d-bugmail at puremagic.com
       
    Tue May 14 23:10:32 PDT 2013
    
    
  
http://d.puremagic.com/issues/show_bug.cgi?id=10085
           Summary: Inefficient codegen for initialisation and variadic
                    arguments
           Product: D
           Version: D2
          Platform: All
        OS/Version: All
            Status: NEW
          Severity: normal
          Priority: P2
         Component: DMD
        AssignedTo: nobody at puremagic.com
        ReportedBy: diggsey at googlemail.com
--- Comment #0 from Diggory <diggsey at googlemail.com> 2013-05-14 23:10:31 PDT ---
Given code such as the following:
struct Vector3i {
    int[3] array;
    this(int[3] array...) { this.array = array; }
}
void main() {
    auto vec = Vector3i(1, 2, 3);
}
When compiled with optimisation and inlining turned on, the generated code will
write to the fixed size array 5 times in the process of initialisation:
1) Write zeros to "vec.array"
2) Write zeros to temporary argument array
3) Write 1, 2, 3 to temporary variables
4) Copy temporary variables into temporary argument array
5) Call "memcpy" to copy temporary argument array to "vec.array"
Clearly this could be done by simply writing 1, 2, 3 to "vec.array". It seems
like any optimisations on these sort of operations would speed up a lot of
code...
-- 
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