[thelist] ASP String Concatenation vs. Response.Write

Ryan Finley RyanF at SonicFoundry.com
Mon Feb 26 14:44:54 CST 2001


It would be interesting to know whether string concatenation gets
progressively slower as the string gets longer...

On my website, I use string concatenation to create surveys.  I then cache
the survey files, and simply serve up the pre-rendered surveys.  The only
database interaction happens when surveys are submitted.

I would like to speed up the rendering process.  Does VB in ASP+ have the
string concatenation performance problem?

Thanks,

	Ryan Finley
	President - SurveyMonkey.com

-----Original Message-----
From: Aylard JA (James) [mailto:jaylard at equilon.com]
Sent: Monday, February 26, 2001 12:55 PM
To: Evolt List (E-mail)
Subject: [thelist] ASP String Concatenation vs. Response.Write


	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

---------------------------------------
For unsubscribe and other options, including
the Tip Harvester and archive of TheList go to:
http://lists.evolt.org Workers of the Web, evolt ! 




More information about the thelist mailing list