Building Performance into Internet Applications


On the first iteration, you get a one-character string, "A." On the second iteration, VBScript has to reallocate the string and copy two characters ("AB") into "s." On the third iteration, it has to reallocate "s" again and copy three characters into "s." On the Nth (26th) iteration, it has to reallocate and copy "N" characters into "s." That's a total of 1+2+3+...+N which is N*(N+1)/2 copies.

In the recordset example above, if there were 100 records and five fields, the inner loop would be executed 100*5 = 500 times, and the time taken to do all the copying and reallocation would be proportional to 500*500 = 250,000. That's a lot of copying for a modest-sized recordset.

In this example, the code could be improved by replacing the string concatenation with Response.Write() or inline script (<% = fld.Value %>). If response buffering is turned on (as it should be), this will be fast, as Response. Write just appends the data to the end of the response buffer. No reallocation is involved and it's very efficient.

In the particular case of transforming an ADO recordset into an HTML table, consider using GetRows or GetString.

If you concatenate strings in JScript, it is highly recommended that you use the += operator; that is, use

s += "some string", not s = s + "some string"

Here are a few other considerations when taking performance measures:

  • Different isolation levels with IIS configuration should be tested in-depth. There are three isolation levels: low, medium, and high.
  • COM components should be configured appropriately for high performance. There are three configuration options: unconfigured, configured as a library option, and configured as a server option.
  • Use option explicit at the top of your asp pages. This forces developers to declare all of their variables. Declared variables are faster than undeclared variables.
  • Avoid redimensioning arrays.
  • Use trailing slashes in the directory URL. If they are not used, it will take two requests to get the URL resolved. The first request will go to server unresolved and second with added slash to be resolved.
  • Upgrade to latest and greatest. Make sure that all the bits and pieces that are being used on the server are frequently upgraded. Make sure that service packs and patches are applied.
  • HTML compression should be turned on with IIS.


  • "Designing Performance in to Your Web-Based Applications," IBM performance management and capacity planning services
  • "Object Oriented Performance Testing of Web Applications" by Dr. B. M. Subraya and S. V. Subrahmanya, IEEE
  • "Boosting App Server Performance," Application Development Trends, Vol 7, No II
  • "E-Business Testing: User Perceptions and Performance Issues" by Andreas Rudolf and Raniner Pirker, IEEE 0-7695-0825-1/00
  • "Performance Testing E-Commerce Web Systems" by Mike Hagen. Presentation paper, Vanguard Group, 3 May 2002
  • "Load Testing for E-Confidence," Segue software
  • "Scaling the Web" by Daniel. A. Menasce, George Mason University

About the author

About the author

AgileConnection is a TechWell community.

Through conferences, training, consulting, and online resources, TechWell helps you develop and deliver great software every day.