Assuming that your script is going to be able to produce some output immediately, and then some more after some delay through DB access or similar?

Depending upon the type of formatting of your HTML, some (most?) browsers will be able to start to render the page from the partial output from the early prints therebye giving the user a feeling that things are happening. This can be advantagous.

If you save it all up and print it all in one go, it may result in a longer delay before the browser starts to render something, which may cause the perception of a slower site than they might otherwise have.

This effect is particularly noticable when rendering large volumes of data in tables. If the rows are sent in separate chunks--and if the sizes of the cells are predefined--then most browsers will be able to render the table in chunks, rather having to wait for the whole table to arrive before being able to render anything.

This is one of those cases were perceived performance is probably more important that absolute performance.


Examine what is said, not who speaks.
"But you should never overestimate the ingenuity of the sceptics to come up with a counter-argument." -Myles Allen
"Think for yourself!" - Abigail        "Time is a poor substitute for thought"--theorbtwo         "Efficiency is intelligent laziness." -David Dunham
"Memory, processor, disk in that order on the hardware side. Algorithm, algorithm, algorithm on the code side." - tachyon

In reply to Re: Many prints of small string or one print of huge string? by BrowserUk
in thread Many prints of small string or one print of huge string? by dmitryrusak

Title:
Use:  <p> text here (a paragraph) </p>
and:  <code> code here </code>
to format your post, it's "PerlMonks-approved HTML":



  • Posts are HTML formatted. Put <p> </p> tags around your paragraphs. Put <code> </code> tags around your code and data!
  • Titles consisting of a single word are discouraged, and in most cases are disallowed outright.
  • Read Where should I post X? if you're not absolutely sure you're posting in the right place.
  • Please read these before you post! —
  • Posts may use any of the Perl Monks Approved HTML tags:
    a, abbr, b, big, blockquote, br, caption, center, col, colgroup, dd, del, details, div, dl, dt, em, font, h1, h2, h3, h4, h5, h6, hr, i, ins, li, ol, p, pre, readmore, small, span, spoiler, strike, strong, sub, summary, sup, table, tbody, td, tfoot, th, thead, tr, tt, u, ul, wbr
  • You may need to use entities for some characters, as follows. (Exception: Within code tags, you can put the characters literally.)
            For:     Use:
    & &amp;
    < &lt;
    > &gt;
    [ &#91;
    ] &#93;
  • Link using PerlMonks shortcuts! What shortcuts can I use for linking?
  • See Writeup Formatting Tips and other pages linked from there for more info.