The Open Lighting Project has moved!

We've launched our new site at www.openlighting.org. This wiki will remain and be updated with more technical information.

Pipe vs Unix Socket Performance

From OpenDMX.net
Jump to: navigation, search

Here are some numbers on pipe() vs socketpair() performance. The sample program used either pipe() or socketpair() to create a set of file descriptors. The main thread sent 512MB of data through the fds and then closed the sending side. A receiving thread read all the data until EOF and then exited.


Mac OS X 10.6.8

Pipes
real    0m8.501s
user    0m5.751s
sys     0m4.185s

real    0m8.462s
user    0m5.721s
sys     0m4.078s

Unix Sockets
real    0m9.782s
user    0m6.329s
sys     0m7.301s

real    0m9.992s
user    0m6.360s
sys     0m7.417s

Linux 2.6.26-2-amd64

Pipes
real    0m8.376s
user    0m5.376s
sys     0m2.952s

real    0m8.319s
user    0m5.184s
sys     0m3.096s

Unix Sockets
real    0m9.469s
user    0m5.840s
sys     0m3.480s

real    0m9.364s
user    0m5.500s
sys     0m3.792s

Linux 2.6.32 armv5tel

This benchmark only sent 51 MB of data.

Pipes
real    0m11.083s
user    0m8.560s
sys     0m2.480s

real    0m12.079s
user    0m9.070s
sys     0m2.250s

Unix Sockets
real    0m12.882s
user    0m9.920s
sys     0m2.930s

real    0m11.944s
user    0m8.650s
sys     0m3.030s

Linux 2.6.18 VM

This benchmark only sent 51 MB of data because it was running in a VM.

Pipes
real	0m9.359s
user	0m2.377s
sys	0m1.603s

real	0m11.233s
user	0m2.253s
sys	0m2.345s

Unix Sockets
real	0m10.903s
user	0m2.178s
sys	0m2.380s

real	0m11.053s
user	0m2.280s
sys	0m2.422s