[pooma-dev] RFA: delete_test1 Modifications
James Crotinger
JimC at proximation.com
Thu May 24 23:17:54 UTC 2001
copy doesn't have the same semantics as memmove and so it is potentially
faster (it can only copy overlapping regions if the destination is before
the source, which is the case in the shift-up copies, which almost always
involve overlapping regions). However, I did a lot of testing with KCC on
the SGI and found that for larger moves, memmove was faster. This is why I
put a test into the delete_shiftup algorithm to use copy only if the length
of the copy was less than 100 (a good round number). Someone (named julianc)
has since commented out that code without leaving a comment in the source as
to the reason. Looking at the log I see that it was due to VC++ not having a
proper std::advance. This should have just been coded around. At any rate, I
didn't add this complication lightly. Now perhaps KCC has since written copy
to use memmove so I don't know if my investigations from early 2000 are
still valid.
Jim
> For those skipping intermediary emails, the discussion is whether
> memmove() is faster than copy().
>
> Attached is a program that constructs a vector, copies its contents to
> another vector, and then checks the copy for correctness. On
> Linux/gcc3.0 and Irix6.5/KCC, I cannot find any significant speed
> difference between std::copy and std::memmove for vectors of doubles.
> Given this result, may we use std::copy() everywhere since it is
> guaranteed to compile?
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://sourcerytools.com/pipermail/pooma-dev/attachments/20010524/527102ea/attachment.html>
More information about the pooma-dev
mailing list