digitalmars.D - std.algorithm.swap and memcpy
- dsimcha (3/3) Jul 06 2009 I saw in the changelog that std.algorithm.swap now uses memcpy because i...
- Andrei Alexandrescu (4/7) Jul 06 2009 The problem was that the copy construction and assignment were
I saw in the changelog that std.algorithm.swap now uses memcpy because it's faster than the old way. Why is this? If memcpy is faster, how come DMD doesn't generate the same instructions for normal assignment?
Jul 06 2009
dsimcha wrote:I saw in the changelog that std.algorithm.swap now uses memcpy because it's faster than the old way. Why is this? If memcpy is faster, how come DMD doesn't generate the same instructions for normal assignment?The problem was that the copy construction and assignment were previously used. Those could be intercepted and made arbitrarily costly. Andrei
Jul 06 2009