Applications Home|Email

 A Fast String Builder Class For Classic ASP.

What is the fastest way to build large strings with ASP? By string concatenation, Response.Write or by using a special designed vbscript class?

Concatenation strings is typically done like this:

For i = 1 To 10000
    sResult = sResult & "Classic ASP is still alive and kicking!"

A simple experiment produces this (not very scientific) table:

Iterations: Concatenation: Response.Write: ASPString Class
10000 5,9 sec 0,015 sec 0,2 sec
100000 Don't even try this! 0,106 1,9 sec

The result indicates clearly that a simple response.write is the fastest technic. But if you have to actually build the strings and store them somewhere before you output them, you can't use response.write. Instead you could use a string class like ASPString as an alternative to server components. Of course, we are dealing with very large strings here, irrelevant for most web applications. In a more normal scenario there is absolutely no problem with using some simple string concatenation.

- View cASPString.txt.

- Simple demo code.

Therefore: For that or this for it.
© www.u229.no