This is similar to:
Printing to the console vs writing to a file (speed)
I was confused because there are two conflicting answers. I wrote a simple java program
for(int i=0; i<1000000; i++){
System.out.println(i);
}
and ran it with /usr/bin/time -v java test
to measure time to output to stdout, then I tried /usr/bin/time -v java test > file
and /usr/bin/time -v java > /dev/null
. Writing to console was slowest (10 seconds) then file (6 seconds) and /dev/null
was fastest (2 seconds). Why?