[thelist] RE: WriteLine optimization? - Partial Answer

Luther, Ron Ron.Luther at COMPAQ.com
Tue Apr 23 09:40:00 CDT 2002


Hi Gang,


I asked yesterday about {guidelines/suggestions for optimizing ASP [fileobject.WriteLine "stuff"] lines}.

Thought I'd share the results of a little test I ran this morning. (Yeah - derived from but a little different that the stuff on 4guys and ASPToday.)

I wrote a little script to create three files, each containing a large table. [It needed to be a *large* table in order to see the efficiency differences.]

In the first file I wrote out 250,000 rows using:
* objHtm.WriteLine "<tr><td>Col 1</td><td>Col 2</td></tr>"

This took about 3 seconds.


In the second file I wrote out another 250,000 rows, this time using:
* objHtm.WriteLine "<tr>" & _
	"<td>" & _
	"Col 1" & _
	"</td>" & _
	"<td>" & _
	"Col 2" & _
	"</td>" & _
	"</tr>"

This took about 5 seconds.


In the third file I wrote out another 250,000 rows, this time using:
* objHtm.WriteLine "<tr>"
* objHtm.WriteLine "<td>"
* objHtm.WriteLine "Col 1"
* objHtm.WriteLine "</td>"
* objHtm.WriteLine "<td>"
* objHtm.WriteLine "Col 2"
* objHtm.WriteLine "</td>"
* objHtm.WriteLine "</tr>"

This took about 25 seconds.


{The script was run locally using PWS.  I used Now() to print the timestamp to the nearest second - so take these as 'relative' times rather than absolute.}

While certainly not 'exhaustive' research, it does seem to indicate that long extended lines have less of a performance penalty than multiple calls to 'WriteLine'.



<tip subject="ASP WriteLine" author="RonL.">

Minimize the number of 'WriteLine' calls in your program to improve efficiency.  Extended lines carry less of a performance penalty that separate calls to 'WriteLine'.

</tip>


HTH someone else,

RonL.
(Off to extend some lines and rip out some WriteLines!)





More information about the thelist mailing list