Optimizing ASP Programs

Source: Internet
Author: User
Tags web services
Program | Optimize ASP programming should be more easy to use, using FrontPage, vi and other tools, can be very convenient to construct the Web page,
Scripting languages like Vbscript/javascript are also easy to get started with. After mastering the ASP programming, perhaps you compare
Concern is the efficiency of the program, that is, how to make your program more quickly to execute, and less occupy the server's CPU and
Memory overhead, which is important, if a lot of people visit your site, this factor must be considered, otherwise the system
It's not fun to crash.
Here our discussion is dominated by VBScript discussion.
1. Avoid using a dynamic array of VBScript.
The dynamic array of VBScript is used in situations where the data cannot be determined, but unfortunately the dynamic allocation
Time, the speed is slow, occupies the system resources to be many.
2. Avoid writing programs for sorting.
When you sort an array, if there are many elements of the array, the program will take a lot of time to complete the
Job.
3. Handle a large number of string operations reasonably
Use the system's functions as much as possible to avoid using your own scripting code, which is slower to execute.
4. Optimize the operation of the database.
If you use a large database, such as MS SQL Server 6.5 or Oracle 8, you should reasonably combine Web services
and the processing of the database server. Use stored procedures instead of a large number of SQL queries to reduce network traffic.
Reduce the returned result set (ResultSet), which is handled by the database server more than the packet data returned to the Web server
Much more efficient.
5. Using ASP Components
Invoke ASP parts to handle complex operations, file reads and writes, and large-capacity string processing.

How to determine the execution time of an ASP program
<%
Dim t1,t2
T1=now ()
' Your ASP code place here
' .......
T2=now ()
Response.Write "Execute with" &cstr (CDbl (T2-T1) *24*60*60)) & "seconds"
%>
How your program is very short, using the above method has no meaning: The display result equals 0. But if you're doing data
Library query, it is necessary to understand this information.



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.