Beefy Boxes and Bandwidth Generously Provided by pair Networks
We don't bite newbies here... much
 
PerlMonks  

Re: SLOW DOWN, you move too fast.....

by ikegami (Patriarch)
on Aug 08, 2006 at 14:40 UTC ( #566172=note: print w/replies, xml ) Need Help??


in reply to SLOW DOWN, you move too fast.....

Another possibility is that you are suffering from buffering.

Replies are listed 'Best First'.
Re^2: SLOW DOWN, you move too fast.....
by chromatic (Archbishop) on Aug 09, 2006 at 01:36 UTC

    ... except that, as far as any of us can tell from the code, it prints to standard output (line buffered by default) and includes a newline. Even if all of the variables in that line are empty, this will still print at least 4654 characters, which is larger than most default standard output buffers I've seen in use (and the user is seeing at least some output).

    Unless there's an IO layer somewhere with a very weird buffering behavior, I see no possible way this could have anything to do with buffering. print calls to STDOUT attached to a terminal and including a newline almost never have buffering problems.

      First, you have no way of knowing how many bytes were printed, so you have no idea if the number of bytes is a multiple of a reasonable buffer size. How then can you claim the buffering is weird?

      Second, the number of bytes that didn't print is even more telling. Could 73 lines fit in a normal buffer? Probably.

      Thirdly, why do you assume he's printing to a tty? To count the lines exactly, he probably redirected stdout. That disables line buffering.

      Finally, that a line was only partially printed is a very good indicator of a buffering problem.

        ...you have no way of knowing how many bytes were printed...

        I gave the minimum lower bound.

        Second, the number of bytes that didn't print is even more telling.

        I repeat your first assertion. How do you know the number of bytes that didn't print?

        Thirdly, why do you assume he's printing to a tty?

        In the absence of any other information, what else is there to assume?

        To count the lines exactly, he probably redirected stdout. That disables line buffering.

        The OP had to notice the problem before deciding to count the lines exactly. There's no way of knowing without more information. You might as well assume $|++ somewhere in the program.

        Finally, that a line was only partially printed is a very good indicator of a buffering problem.

        ...or unexpected data, such as \r or \b characters.

Log In?
Username:
Password:

What's my password?
Create A New User
Domain Nodelet?
Node Status?
node history
Node Type: note [id://566172]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this? | Other CB clients
Other Users?
Others romping around the Monastery: (5)
As of 2022-10-06 08:23 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?
    My preferred way to holiday/vacation is:











    Results (26 votes). Check out past polls.

    Notices?