in reply to Re^4: how many chars/bytes does STDOUT buffer (docs)
in thread how many chars/bytes does STDOUT buffer
By other hand if you add a newline to the dot, the program prints a dot a second:perl -e "for (1..10){print qq(.);sleep 1}"
You can also force Perl to print out his buffer as soon as possible setting the $| $OUTPUT_AUTOFLUSH ( see perlvar) to something true:perl -e "for (1..10){print qq(.\n);sleep 1}"
When the output is directed to a pipe or to a file, the normal expected behaviour is to print when the buffer is full, in this way optimizing a lot the overall execution. Also in this situation you can profit of $| to flush buffer as soon as possible. You can test this behaviour writing to a tempfile and using tail on that file in another shell window.perl -e "$|++;for (1..10){print qq(.);sleep 1}"
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re^6: how many chars/bytes does STDOUT buffer (optimization)
by tye (Sage) on Apr 03, 2015 at 13:12 UTC |