back to memcpy eh?

Pennell, David DPennell at quallaby.com
Fri Dec 14 14:08:20 UTC 2001


> Right now we use just some very basic SLANG which produces rather 
> basic C code. But I'm back to suggesting we examine those two areas 
> and use bcopy and bzero for this. Many platforms have fairly well 
> optimized OS routines for this.

Paraphrased from Sun Performance and Tuning by Cockcroft&Pettit:
Solaris 2.5 and later have platform specific versions of libc.  
On UltraSPARC's bcopy,bzero,memcpy,memmove,memset,memcmp use cache 
coherent and nonpolluting VIS block move instructions. 
"Nonpolluting" means that data is moved and not cached.  If you copy
a 1-MB buffer, the cache is untouched.  I assume that late model
Intel and PPC processors provide similar instruction.  If you are
dynamically linked to libc, you get the platform specific library.

We did some (very) adhoc testing a couple of years ago to ascertain 
the threshold between a simple C loop and call bcopy and it was 
surprisingly low.  Unfortunately, I don't have that data anymore.  
I expect that using Duff's Device would change that ratio.

I just took a quick look at bcopy and memcpy in FreeBSD 4.1.  bcopy
is just a simple loop and memcpy is a macro that invokes bcopy.

-david





More information about the Squeak-dev mailing list