in reply to Why is this script not giving real-time output to browser?

You learn something new everyday.

$| = 1; caused it to spit out updates in real time. Thanks. Maybe just a paranoid impression, but it seems to run slower like this, but not surprising.

Forget that fear of gravity,
Get a little savagery in your life.

  • Comment on Re: Why is this script not giving real-time output to browser?

Replies are listed 'Best First'.
Buffering is Good!
by chromatic (Archbishop) on Feb 10, 2005 at 20:01 UTC

    Yes, it will run more slowly. Buffering is an optimization. It's almost always a good thing.

    If you really need to send data as soon as possible (because the time it takes to generate the data is much longer than the time you lose waiting to send optimally-sized network packets with all of the overhead and latency there), disabling buffering at the right place and for the right amount of time is a worthwhile tradeoff.

    Don't make the mistake too many people here do, though, in thinking that buffering is always a problem. It's not. It's on for very good reasons. They don't always apply, but it helps far more often than it hurts, in my experience.

    Disabling buffering globally by default is a code smell, in my opinion.