On Sun, Mar 17, 2002, guy keren wrote about "Re: pthreads question": > > On Sat, 16 Mar 2002, Malcolm Kavalsky wrote: > > > I attach a program benchmark.c that compares speed of memcpy versus data > > transfer > > over unix sockets. > > on my PC (AMD k-6 II 366MHz w/256MB RAM, kernel 2.2.20): > > [choo@simey ~]$ gcc -O2 benchmark.c > [choo@simey ~]$ ./a.out > Memcpy'ed 2000 blocks of size 1048576 in 38 seconds => 52 Mbytes/second > Sent 2000 blocks of size 1048576 in 94 seconds over unix socket => 21 > Mbytes/second > [choo@simey ~]$
Similarly, on Redhat 7.2 and kernel 2.4.7-10, Pentium III (Katmai) 500 MHz: $ a.out Memcpy'ed 2000 blocks of size 1048576 in 12 seconds => 166 Mbytes/second Sent 2000 blocks of size 1048576 in 14 seconds over unix socket => 142 Mbytes/second So unix domain sockets are slightly slower, but not significantly slower (because you sent huge 1MB buffers) than a straight memcpy. I cannot be faster. No way. You don't even need to look in the source for that: if the semantics of the API is that data from one malloc'ed buf suddenly appears in another malloc'ed buf (and the server is free to then change the data it sent without affecting the client) - then a copy *must* be made. Something is wrong in your original measurement, but I have no idea what. -- Nadav Har'El | Sunday, Mar 17 2002, 4 Nisan 5762 [EMAIL PROTECTED] |----------------------------------------- Phone: +972-53-245868, ICQ 13349191 |We are Microsoft. You will be http://nadav.harel.org.il |assimilated. Resistance is futile. ================================================================= To unsubscribe, send mail to [EMAIL PROTECTED] with the word "unsubscribe" in the message body, e.g., run the command echo unsubscribe | mail [EMAIL PROTECTED]