Program | Tips ASP is a server-side command execution environment that makes it easy for you to make interactive Web applications. As one of the most widely used technologies for developing Web servers on NT platforms, its emergence replaces many of the things that used to be done with CGI technology, and the ASP's control of the database is simple and efficient, eliminating the large number of CGI programming work.
Because the ASP directly operates on the server, the technique of ASP design is very important, the improper ASP application can increase the burden of the Web server and reduce the performance of the server. I summed up a year to their own ASP design experience, I hope to be helpful to everyone, the wrong place I hope you correct me.
This article discusses mainly the performance improvement techniques of the ASP program, which includes two parts:
* Improve the performance of HTML page skills
* The technique of improving the reaction time of ASP program
I will discuss these two aspects in detail below.
1. Several tips for improving the performance of HTML pages
The performance of the HTML page is primarily related to the performance of the client's computer, which, in general, is closely related to the hardware of the client's computer and the bandwidth the customer has, and there are several factors that affect the performance of the HTML page:
As we all know, the smaller the page, the less time to load in the browser, the better the performance. Here are some useful tips for reducing the size of a page:
(1) Reduce the number of images: When your page contains n images, your browser sends n requests to the Web server, which wastes a lot of time, especially to avoid inserting a large number of images in the face when the bandwidth is narrower.
(2) Reduce the use of the framework: the framework is another way to reduce the speed of the page display elements, like the image, the browser will send the server n requests, therefore, also avoid a large number of frame use.
(3) Avoid the use of tables: although a beautiful page without the table, but we should reduce the use of unnecessary forms, which will speed up the loading of the page.
(4) Do not add comments in HTML
(5) Avoid using long file names, develop the habit of using relative paths.
(6) When unnecessary, do not use the script, otherwise it will reduce the display speed of the page.
2. Several techniques to improve the reaction time of ASP program
Further points, improve the response time of ASP also involves three aspects of content:
* The performance of the ASP itself to improve the skills
* Network Bandwidth
* Improve the performance of the database skills
I will tell you the contents of these three aspects in detail below.
A Improving the performance of the ASP page itself
(1) Reading object variables is always slower than reading local variables, so you should develop the habit of transferring object variables to local variables, which improves the response time of the ASP, and the following two examples are a good contrast:
Slow Example:
If Myobj.value = 0 Then
Do slightly
ElseIf myobj.value > 0 Then
Do slightly
ElseIf Myobj.value < 0 Then
Do slightly
End If
A quick example:
MyVar = Myobj.value
If MyVar = 0 Then
Do slightly
ElseIf MyVar > 0 Then
Do slightly
ElseIf MyVar < 0 Then
Do slightly
End If
The quick example above is just a minor change, but there is a lot of improvement in performance.