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

Joshua Olson joshua at waetech.com
Fri Jan 11 07:16:11 CST 2002


Anthony,

The technique I normally use to code pages is to do the queries at the top
of the page along with whatever calculations may be necessary.  Then, within
the actual HTM actually do the outputting with all the calculations.  If the
circumstances do not allow this to work, then keep the following in mind.

String contatenation is a process killer, like you've discovered, and
therefore should be avoided as much as possible.  However, if you must do
string contatenation, construct the huge string smaller chunks,  That is,
instead of always concatenating the same string variable, use a series of
variable (perhaps in an array or something) and, for example, contatenate
the first 10 rows into the first variable, the second 10 rows into the
second variable, etc.  Then, when all the rows have been processed,
contatenate all the rows together into the huge string (or, do not
contatenate at all, but simple loop through the array at the point of
output)  It would probably be a rather simple matter to create a class to
facilitate this that automatically keep track of the count of concatenations
and creates a new work variable within itself automatically.  The class
could also have an "output" type function that could loop through its
internal array and send it to response.write.  Just a though.

HTH,

-joshua

----- Original Message -----
From: Anthony Baratta <Anthony at Baratta.com>
Subject: [thelist] Response.Write versus varHTML = varHTML & "..."


> As I said this process worked great for me, until today. We are designing
a
> nifty little tool that can (at times) pull up quite a large number of rows
> of data to be thrown to the screen. The above system works great when
there
> are about 50-75 rows of data. However the page becomes unbearably slow
> (long processing time server side, watching with Task Manager and the
> server bouncing above 80% most of the time) when the number of rows gets
> over 100-150.






More information about the thelist mailing list