NetBSD-Users archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

Re: memove performance of NetBSD



On Jan 24, 2010, at 10:14 PM, Channa wrote:
> Thanks you very much for the information i checked the links.

You're most welcome.

[ ... ]
> However i tested the algorithm as below:
> 
> memmove(dst,src,sizeof(src) // Performance is good
> memmove(dst,src+4,sizeof(src) // Performance is good since 'src' is aligned
> 
> If I perform memove as below:
> 
> memmove(dst,src + 1,sizeof(src) // Performance degrades
> memmove(dst,src + 2,sizeof(src) // Performance degrades
> 
> since in the above calls of memmove() the source is unaligned.

Yes, it's expected that unaligned access will be noticeably slower.  There 
isn't an easy solution for that or it would already be in use, although doing a 
prefetch (MIPS32 PREF) on the source will help.

For what it's worth, people who have benchmarked bcopy/memmove tend to find 
that unaligned accesses happen infrequently and generally for fairly small 
lengths (ie, typical string / log message processing).  If your code does 
frequent large unaligned copies, you will likely find that adjusting structs 
and your code to work with the native alignment will result in more benefit 
than trying to hack on bcopy/memmove....

Regards,
-- 
-Chuck



Home | Main Index | Thread Index | Old Index