Improve the efficiency of ASP page Execution (medium)

Source: Internet
Author: User
2. elements that affect ASP

(1). Convert the object variable to the cost variable as much as possible, because reading the land variable is much faster than reading the object variable.

A slow example:

If Myobj.value = 0 Then
Do something
ElseIf Myobj.value > 0 Then
Do something
ElseIf Myobj.value 0 Then
Do something
End If

A quick example:

MyVar = Myobj.value
If MyVar = 0 Then
Do something
ElseIf MyVar > 0 Then
Do something
ElseIf MyVar 0 Then
Do something
End If

(2). If you are using VBScript 5.0 or newer version, try to use with ... End With statement, which also increases the speed at which your program will run.

A slow example:

Myobj.firstname = "Srinivasa"
Myobj.lastname = "Sivakumar"
myobj.city = "Chicago"

A quick example:

With MyObj
. FirstName = "Jinhu"
. LastName = "Horse"
. City = "Chuzhou"
End With

(3). In general, avoiding the use of Session variables helps speed up because different ASP pages run in separate threads, and session calls are not, and he is continuous.


Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.