[thelist] Response.Write versus varHTML = varHTML & "..."

Joshua Olson joshua at waetech.com
Fri Jan 11 12:37:15 CST 2002


Anthony,

You said,
> The whole point of my concern is that you have no control over the flow of
> the code any more. In order to avoid VB/VBS from carpet bombing your
server
> performance you should be printing your HTML to the browser as quickly and
> often as possible.

This I do not understand.  Can you explain this further?  Keep in mind that
the HTML is not actually sent to the browser until the cache is flushed.
The cache is flushed either at the end of the code, or on demand using the
response object.  Until it is flushed, the engine is simply adding whatever
is in the page to the end of the cache.  I'd assume (I not really sure about
this), that the server allocates a certain buffer for the page results
before the processing begins to avoid the same problems as concatenation.
If the rendered page exceeds the buffer length, then more space is added.

Given that, I'm not seeing how performing the queries up front, then doing
the output loops within the context of the HTML, would ever be slower than
concatenating the output strings up front and then pushing them to the
browser in a single step.

Furthermore, if the loop was outputted as it cycled on a very large dataset,
such as 10000 rows or so, then you could conceivable flush the cache every
few rows to give a quicker response to the user.  Using your original
technique you'd be forced to concatenate all the data first (yuck) then push
it in one sweep to the user.  There could be no option to flush the cache
mid-render.

If maintenance is another concern, then you could do what Howard suggested:
you could always call the functions for rendering the dataset from within
the HTML section of the code to ease the process of updating the logic.
This should effectively give you the same ease of maintaining the code as
your current system of string concatenation provides.

Gotta run, HTH,

-joshua






More information about the thelist mailing list