July 06, 2009 std.algorithm.swap and memcpy | ||||
|---|---|---|---|---|
| ||||
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 Re: std.algorithm.swap and memcpy | ||||
|---|---|---|---|---|
| ||||
Posted in reply to dsimcha | 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
| |||
Copyright © 1999-2021 by the D Language Foundation
Permalink
Reply