[Issue 10402] New: memmove optimization for std.algorithm.copy

d-bugmail at puremagic.com d-bugmail at puremagic.com
Tue Jun 18 05:24:35 PDT 2013


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

           Summary: memmove optimization for std.algorithm.copy
           Product: D
           Version: unspecified
          Platform: All
        OS/Version: All
            Status: NEW
          Severity: enhancement
          Priority: P2
         Component: Phobos
        AssignedTo: nobody at puremagic.com
        ReportedBy: tommitissari at hotmail.com


--- Comment #0 from Tommi <tommitissari at hotmail.com> 2013-06-18 05:24:34 PDT ---
Add an optimization for:

Range2 copy(Range1, Range2)(Range1 source, Range2 target);

...to use the c function memmove when it is safe to do so and the two ranges
overlap each other (when they don't overlap, a vectorized copy should be
faster). As far as I can tell, it is safe to use memmove for copying source
over target if all of the following are true:

1) Both ranges are arrays (static or dynamic)
2) Both arrays have the same element type
3) hasElaborateAssign!T is false for the element type T

I haven't benchmarked anything, but all the good C++ standard library
implementations of std::copy seem to do this optimization, and I trust that
they know what they are doing.

-- 
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