home navigator pointer resources navigator pointer asp tips navigator pointer dim statements and vars
The definitive ASP tips page
tips menu | printable single page version

Note: this is my old ASP tips page and is no longer supported. See the new Visualize web site..

ASP Coding for Performance - Dim Statements and Variable use

Declare a number of variables per line, using the Dim statement. This results in less lines to parse. e.g. replace
Dim sMyString
Dim sMyTemp
Dim iCounter
with:
Dim sMyString, sMyTemp, iCounter

Use local variables whenever possible. This not only aids maintenance by localising control, but also speeds up processing since the entire namespace does not have to be searched when the local variable is referenced. Also, copy individual collection values into local variables, if you are going to reference them a number of times (saves multiple lookups). Avoid redimming arrays. Instead, it's probably more efficient to declare the overall max size in advance.

 

DISCLAIMER: Note these pages are a free resource for anyone wishing to reference them. Although every care is taken to ensure their correctness, the author takes no responsibility for any errors or problems that may occur through their use, or indeed misuse. These pages are copyight of Dave Clarke, Visualize Software Ltd 1997-2000 (all rights reserved).


 


© Copyright Dave Clarke, 1996-2008