[thelist] ASP String Concatenation vs. Response.Write

Aylard JA (James) jaylard at equilon.com
Mon Feb 26 14:36:37 CST 2001


	This topic came up very recently -- whether to concatenate ASP
output into a string or to do consecutive Response.Writes (and if I'm
duplicating previously stated information, I apologize, but I don't think I
am). My understanding -- and I think the general consensus -- has been that
doing lots of consecutive Response.Writes is bad because it forces
context-switching (or some such thing) by the ASP engine, and that
concatenating the output into a single string is preferable.
	An article on ASP101.com
(http://www.asp101.com/articles/john/outputperf/default.asp) strongly
suggests otherwise. The concatenation of numerous strings is such a slow
process, relatively speaking, that it is actually *much* faster --
especially when outputting large chunks of information -- to constantly
Response.Write than to concatenate.
	One weakness of the article (and I hope Evolters will point out any
others) is that it uses VBScript's inexact ability to clock elapsed time. I
reworked the concept using javascript, and got similar results, however.
	Granted, probably some mix of Response.Write and string
concatenation would be reasonable in most cases, but this article seems to
prove that string concatenation is a very slow alternative even to
consecutive Response.Writes.
	Comments?

James Aylard




More information about the thelist mailing list