Eduardo, as we mentioned in the Chatterbox, I think the problem with this benchmark lies with process creation, not TCP vs. PIPEs. With your PIPE code, you are spawning a new process of sendmail each time, however with your TCP code, sendmail is already running.
Additionally, I have a test case on my computer at home (which I cannot get to easily at the moment), with a GO client/server program. Before I separated the two programs, the run time was about 25 seconds, full CPU usage. Once I moved to TCP my run time jumped to almost 2 minutes with CPU never topping over 30-40%. Changing my code once more to use UNIX sockets, I regained full CPU usage and an average run time of 29 seconds. I did not implement a PIPE solution, but I believe UNIX sockets are implemented as a PIPE so the number should between 25-29 seconds if I did, no? :)
Anyway I just wanted to post officially something before everyone ran off making all there PIPE'd programs TCP! :)
Ciao,
Gryn
(p.s. By GO client/server I mean the board game GO, the server sends a 19x19 text array to the client and the client responds back with a move
in this case two random numbers. in the test cases mentioned above this was repeated for about 1,000 moves)