memcpy performance

Chris Johns cjohns at plessey.com.au
Tue Dec 9 06:40:41 UTC 1997


I was having performance problems with 'memcpy' and checked the source
for newlib-1.7.0-posix (same in 1.8.0) and to my suprise found memcpy to
be a byte by byte copy.

Wondering what dependence RTEMS (3.6.0)  had on this so I checked the
code:

 $ fgrep memcpy `find . -name "*.inl" -print`
./exec/score/inline/coremsg.inl:#include <string.h>   /* needed for
memcpy */
./exec/score/inline/coremsg.inl:  memcpy(destination, source, size);
./exec/score/macros/coremsg.inl:  memcpy( _destination, _source, _size)

The actual routine:

RTEMS_INLINE_ROUTINE void _CORE_message_queue_Copy_buffer (
  void      *source,
  void      *destination,
  unsigned32 size
)
{
  memcpy(destination, source, size);
}

So it looks like the message queue core uses byte by byte copies for
messages.

Is this a good thing considering the fast and large bus sizes of newer
CPUs ?

-- 
 Chris Johns  Networks, Plessey Asia Pacfic Pty. Ltd.
  mailto:ccj at acm.org    mailto:cjohns at plessey.com.au



More information about the users mailing list