The following are tricks to write the good script ASP, so the application can be run properly.

Trik #1 : Response.Buffer = TRUE
This will lead to an ASP script will be stored in a buffer in the server and processed, if all processes have been completed, the new data will be sent to a client. This is to accelerate the execution of the overall ASP script.

Trik #2 : @ENABLESESSIONSTATE = FALSE
Do not use if the session is not necessary. Most web applications are rarely session requires. The use of web session will be slow because the process requires memory and a larger than if no session. By default, IIS provides session on each script executed. To turn them off, writing in the first line of each script.

Trik #3 : Use adovbs.inc or adojavas.inc adequate
File adovbs.inc and adojavas.inc amount of about 14 Kb. If the file is in the script include in each, will slow server, although the difference is small. Take meant only as needed, you do included if not needed. Usually that is needed in the web application is just normal 2 Kb of 14 Kb that.

Trik #4 : The local variables accessed faster than global variables
The local accessed more quickly than global variables. If you need to call the global variable many times in page script, better global variable is inserted into a local variable.

Trik #5 : Avoid calling COM object more than twice
Calling data from the COM object need a long time. If the data is called from COM object will be used repeatedly in the one-page script, then enter the data into a local variable. Example: strNama = Request.Form ( "name"). Do not call Request.Form ( "name") repeatedly in one page. Self once, and then strNama variables used in the processing of the next.

Trik #6 : data type Collection is slow
Type of data collection are usually accessed with a statement for each. This type of data accessed slow. If the page script this should be done repeatedly, enter data in the collection into local variables, such as arrays.

Trik #7 : Avoid redim arrays
Avoid redimensioning arrays. Redimesioning require a long time and memory allocation can be a mess. Better declare arrays as needed in the initial script.


Trik #8 : One scripting language per page
If a page using VBScript, the entire page is better to use VBScript, JScript or not PerScript. Similarly vice versa. Substitution scripting languages in one page will discard the useless, you will also be confusing in making debugging




Collection of articles asp


Categories: