I'm no kernel guru (*far* from it), but I suspect that shared memory can be *slightly* faster than sockets. Here's why:
I suspect that the kernel will notice that the connection is local and use a kernel-space buffer for the data you send/recv directly instead of sending it to eth0/whatever. "But wait, this sounds just like shared memory" you say. not exactly--your program has to switch to kernel-mode to stuff the data into the buffer or read from it. With shared memory, you just go at it.
that being said, there may be a smarter implementation (which I'm dying to hear about--yet I'm too lazy to "use the source, luke"
), but this is the one that's obvious to me.