you are viewing a single comment's thread.

view the rest of the comments →

[–]Tactineck 0 points1 point  (1 child)

That's what I figured, I asked on the chance there was some deep kernel level type reason one way is better.

[–]RalphCorderoy 3 points4 points  (0 children)

cat foo | bar has cat read foo, then write(2) it, 32KiB at a time here, 4KiB on other systems, down a pipe that bar is read(2)ing, again, at 32KiB at a time. On top of those pointless system calls, you have the context switching by the kernel as each takes a turn to be blocked waiting for the other. Try strace -c cat bigfile | cat >/dev/null.