0

Possible Duplicate:
Should I care about unnecessary cats?

Both would be functionally equivalent, but when using cat wouldn't it be slower because you have a process first reading the file and then sending it through a pipe to another process, instead of the process just reading the file? But I've seen this usage 'cat file | program' in a lot of examples. I assume they wouldn't use it that much in examples if it had bad performance.

0

1 Answer 1

5

Yes, but the bigger slowdown would be starting up the first process(cat).

However, seeing as how the difference is minimal on any computer made in the last 15 years that isn't loaded down very heavily(load avg < 30), the bigger disadvantage is code readability.

1
  • A big +1 for the practical advice, focusing on readability.
    – Cascabel
    Jul 17, 2011 at 7:12

Not the answer you're looking for? Browse other questions tagged .