Therefore, asp is the least restrictive among the many languages that I have come into contact with, and it is the one with the lowest requirements on programmers.
Yesterday I tested asp.net, php, and asp Running Speed comparison. Today I am impulsive. I want to see how much the effects of defining variables and non-defining variables on asp running efficiency are. The results are surprising, asp program-Defined variables are twice faster than non-Defined variables!
The test program was run for 10 million times yesterday to obtain the execution time.
1. The program does not define variables (dim I) Copy codeThe Code is as follows: <%
Dim startime
Startime = timer ()
For 1 to 10000000
Next
Dim endtime
Endtime = timer ()
Response. Write "Page execution time:" & FormatNumber (endtime-startime) *) & "millisecond"
%>
2. The program defines the variable (dim I)
Copy codeThe Code is as follows: <%
Dim I
Dim startime
Startime = timer ()
For 1 to 10000000
Next
Dim endtime
Endtime = timer ()
Response. Write "Page execution time:" & FormatNumber (endtime-startime) *) & "millisecond"
%>
Each program is executed five times (except for the first execution), and then the average value is obtained. The test results are as follows:
| Define Variables |
Execution time |
Average time |
| No |
1890 ms |
1859 ms |
1844 ms |
1875 ms |
1859 ms |
1865 ms |
| Yes |
890 ms |
890 ms |
984 ms |
875 ms |
890 ms |
905 ms |
According to the above test results, the execution speed of asp is twice faster than that of non-Defined variables.
As for why, I have not studied it further. However, through this example, I really feel that standardized programming can make the program run more efficiently. For non-standard programming, although the language itself is fault tolerant, the analysis process is time-consuming. Of course, for a simple program, there may be little difference between the norm and the non-norm, but if the system you develop is large, there are many pages, and there are many function calls, the difference between the time consumed by the specifications and non-standards will be highlighted, namely, 1 or 2 times less, and dozens of times more are not surprising.