ASP 101 - Active Server Pages 101 - Web05
The Place ASP Developers Go!

Please visit our partners


Windows Technology Windows Technology
15 Seconds
4GuysFromRolla.com
ASP 101
ASP Wire
VB Forums
VB Wire
WinDrivers.com
internet.commerce internet.commerce
Partners & Affiliates














ASP 101 is an
internet.com site
ASP 101 is an internet.com site
IT
Developer
Internet News
Small Business
Personal Technology

Search internet.com
Advertise
Corporate Info
Newsletters
Tech Jobs
E-mail Offers

ASP 101 News Flash ASP 101 News Flash



 Top ASP 101 Stories Top ASP 101 Stories
Getting Scripts to Run on a Schedule
The Top 10 ASP Links @ Microsoft.com
What is Adovbs.inc and Why Do I Need It?

QUICK TIP:
Name Your Development Sites
Show All Tips >>
ASP 101 RSS Feed ASP 101 Updates


Quick Tips


Use variables to speed up collection access
Whenever you access a collection such as Request.ServerVariables or Request.Form, the script processor needs to go into the collection to look up the value of the item you request. While this doesn't seem like it takes a long time, it's actually relatively slow when compared to accessing local variables.

If you find yourself using the same item from a collection more than a couple times, declare a local variable and assign the value of the item in the collection to it the first time you need to access it. From then on you can use the local variable to retrieve the value to prevent the computer from needing to access the collection again.

The same thing goes for things like the field object of a recordset. Using a local variable saves the collection lookup time and while it may seem trivial, think about some of the loops that you're doing it inside of. A little bit of inefficiency adds up all of a sudden when you consider the number of times you're doing it!

You won't notice a huge speed increase. In fact, you probably won't even be able to tell the difference, but on a high traffic site the small amount of time saved each time the page is run can really add up.
Previous      Show All Tips      Next

If you have a tip you would like to submit, please send it to: webmaster@asp101.com.


Home |  News |  Samples |  Articles |  Lessons |  Resources |  Forum |  Links |  Search |  Feedback

Internet.com
The Network for Technology Professionals

Search:

About Internet.com

Legal Notices, Licensing, Permissions, Privacy Policy.
Advertise | Newsletters | E-mail Offers