Analysis of methods to improve ASP page execution efficiency

Source: Internet
Author: User

These are mostly related to hardware. In fact, in software, a good program design method and correct parameter configuration can also improve the program performance. Sometimes, if you change a parameter under the same circumstances, the program execution efficiency can be greatly improved. This article will try to explore this area.
1. Factors Affecting Performance
The performance of ASP programs depends on the following two major aspects:
1. execution efficiency of HTML pages
2. reaction time, in which the reaction time is mainly subject to the following elements:
(1). ASP page execution efficiency
(2) database Factors
Next we will discuss it in detail.
Ii. Detailed discussion
1. Factors affecting HTML
The execution efficiency of HTML pages is a pure client problem. The main factors that affect this problem are the client hardware and its network bandwidth. In addition, some of the following factors can also affect the execution efficiency of HTML pages.
(1). Image factors. Avoid using images on HTML pages. This is because when a browser requests a page, if the page contains N images, the browser will request N calls to the WEB server. Such requests will reduce the page loading process. This affects the speed.
(2) framework issues. Using a framework in a webpage also reduces the page loading process. Similar to image factors, loading a framework requires N requests.
(3). Avoid using tables as much as possible, especially avoid using multiple tables. Complicated tables may affect the efficiency of HTML execution.
(4) Remove unnecessary tokens. Let's take a look at the following example:

Copy codeThe Code is as follows: <Body> <br>
<P> <font face = "Verdana" size = "4"> <br>
</Font> </P> <br>
<P> <font face = "Verdana" size = "4"> <br>
</Font> </P> <br>
<P> <font face = "Verdana" size = "4"> <br>
</Font> </P> <br>
</Body> <br>
You can remove the <font> identifier as follows:
<Body> <br>
<Font face = "Verdana" size = "4"> <br>
<P> <br>
</P> <br>
<P> <br>
</P> <br>
<P> <br>
</P> <br>
<Font> </Body> <br>

(5). Reduce comments, which will reduce the file size. This increases the loading speed.
(6) Avoid using long file names and try to use relative paths to access other files on the page.
(7) Avoid using Java Applets on HTML pages. For example, if you want to use Java Applets to process animations, you can consider using GIF files or FLASH instead, which is much faster than Java Applets.
2. elements that affect ASP
(1) try to convert the object variable to the local variable because reading the local variable is much faster than reading the object variable.
Slow example:Copy codeThe Code is as follows: if Myobj. Value = 0 then
Do something
Elseif Myobj. Value> 0 then
Do something
Elseif Myobj. Value <0 then
Do something
End if

Example:Copy codeThe Code is as follows: 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 an updated version, try to use the With... End With statement, which can also speed up your program running.
Slow example:Copy codeThe Code is as follows: Myobj. FirstName = "Srinivasa"
Myobj. LastName = "Sivakumar"
Myobj. City = "Chicago"

Example:Copy codeThe Code is as follows: With Myobj
. FirstName = "Jinhu"
. LastName = "Ma"
. City = "Chuzhou"
End

(3 ). in general, avoiding the use of session variables helps increase the speed. This is because different ASP pages run in different threads, but session calls are not like this, and they are continuous.
3. Database Problems
Designing a database structure can greatly improve the program running speed. Of course, designing a database structure is not a problem discussed in this article. Let's first assume that the database structure has been designed to see what else can be done to speed up program running.
(1) If your database server and WEB server are the same, it is best to separate them. This will certainly increase the speed.
(2) If you access the database, it is best not to use dynamic SQL statements and stored procedures or views.
(3). Sometimes assigning appropriate database buffers improves program performance. This is because, if you are using an Oracle database, you need to enable three sessions for each connection. If you can handle these things well, you will improve the program performance.
Summary
In fact, there are many factors that affect the execution speed of ASP programs. The above is only part of it. Of course, some of the above skills are not necessarily suitable for all ASP programs. Different policies should be adopted for different programs. Finally, I hope this article will help you.

Related Article

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.