This is the mail archive of the libstdc++@gcc.gnu.org mailing list for the libstdc++ project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: Performance of copy algorithm


On Monday, February 3, 2003, at 10:06 PM, Jerry Quinn wrote:

A couple of observations.  First, memcpy is very fast - the compiler
doesn't have enough optimization to squeeze the same performance out
of the straight loop.  Second, we are taking a HUGE performance hit by
using memmove for this case.  I figured memmove might be about
equivalent, but apparently not.
This is highly system dependent, and you don't say what OS you're
using for your test.

I know of one OS where memcpy is slower than a handwritten loop
(because memcpy on that system is stupid and always uses byte
instructions instead of word instructions), and I know of another OS
where memmove is very fast and memcpy is nothing but an alternate
name for it.

It's entirely possible that what you ought to be doing is improving
your OS's libc.  memcpy and memmove ought to be carefully written
hand-optimized assembly code.  Your tests might just show that on
your system nobody has given them the love and care that they
deserve.

			--Matt


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]