Register Now! Download Now! ASPFast

Home

Features

Performance

Download

Register

Documentation

Support

Performance - Why as ASPFast faster...

Building an HTML table from a database recordset involves a lot  of string concatenations. As the table gets bigger Visual Basic Script (the default language of ASP) slows down and uses more and more server resources.

When performing repeated concatenations of the type:
Do While Not rs.EOF
    DestinationString = DestinationString & rs.fields("SourceString")
    rs.MoveNext
Loop

the length of time increases proportionally to N-squared. Therefore, 1000 iterations will take about 100 times longer than 100 iterations. This is because Visual Basic does not just add the SourceString characters to the end of the DestinationString string; it also performs the following operations:

1. Allocates temporary memory large enough to hold the result.
2. Copies DestinationString to the start of the temporary area.
3. Copies SourceString to the end of the temporary area.
4. De-allocates the old copy of DestinationString.
5. Allocates memory for DestinationString large enough to hold the result.
6. Copies the temporary data to DestinationString.

Steps 2 and 6 are very expensive and basically result in the entire concatenated result being copied twice with additional overhead to allocate and de-allocate memory.

ASPFast uses advanced Win32 API functions to allocate memory and copy data bypassing the slower Visual Basic engine calls.

Real world performance gains of over 4000% (depending on table size) can be obtained using ASPFast.

Here is some additional information on string concatenation in Visual Basic:

Hardcore Visual Basic

MSDN: Improving String Handling Performance in ASP Applications

Copyright ©2003 Daniel Biener
All rights reserved.
Home  Features  Home  Performance  Home  
Download  Register  Documentation  Support  Home