Speed in pipes

gda gda at creare.uucp
Thu Jun 13 12:20:17 AEST 1985



Are pipes started by the shell faster than those set up by "popen", "fork
and exec", etc. ?

I've been building a three-generation program (parent-child-grandchild) in
which the three communicate in an ideal manner (no back-talk from the
children), and I tested the system previous to writing all the spawning code
by using explicit pipes in the command line :

		prog1 | prog2		(prog2 spawned prog3)

When I timed this, it ran reasonably fast, so I finished the code for
spawning of "prog2" by "prog1".  When I timed the final form it ran only
half as fast as when done with the explicit pipe.  I ran it under three
conditions in both "before" and "after" cases, one with a small amount of
input data, one with a lot, and one in-between.  There was a fairly linear
relation between data size and execution time.  I tried this with "popen"
and with "fork, exec, and dup2" and got roughly the same results.

This was done on a Masscomp, which is mostly System V.  I used "timex" to
measure the "user" time.  I don't have access to source code.

Any ideas?  Am I missing something?

			Gray Abbott
			Creare Inc.
			Hanover, NH
			{...dartvax!creare!gda}



More information about the Comp.unix.wizards mailing list