July 06, 2009
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?
July 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