zell
zell

Reputation: 10204

In general, does redirecting outputs to /dev/null enhance performance?

Suppose I have a program that prints a large number of messages to stdout, which takes much time. I wonder whether by redirecting the stdout to /dev/null (so that I see no messages in the screen) we can make the program terminate faster?

[Edit] I tries with small examples. Redirecting stdout to /dev/null does make program terminate earlier.

Upvotes: 2

Views: 758

Answers (1)

Mike Dunlavey
Mike Dunlavey

Reputation: 40679

Yes. Outputting to the screen requires a lot of painting. Outputting to a file is much faster, because it's running at disc speed. Outputting to /dev/null is faster yet, because the output goes nowhere.

Upvotes: 3

Related Questions