Therefore, in my exposure to so many languages, ASP is the least stringent one, is the least required for programmers.
Yesterday tested the ASP.net, PHP and ASP running speed comparison, today again to impulse, want to see the definition of variables and undefined variables on the efficiency of ASP, the effect of how much, the result is surprising, the ASP program to define variables faster than the definition of variable speed one times!
Test program or yesterday, run 10 million for loop, get execution time.
1, the program does not define variables (Dim i)
Copy Code code as follows:
<%
Dim startime
Startime=timer ()
For i = 1 to 10000000
Next
Dim endtime
Endtime=timer ()
Response. Write "Page Execution Time:" & FormatNumber ((endtime-startime) *1000,3) & "milliseconds"
%>
2, the program defines the variable (Dim i)
Copy Code code as follows:
<%
Dim i
Dim startime
Startime=timer ()
For i = 1 to 10000000
Next
Dim endtime
Endtime=timer ()
Response. Write "Page Execution Time:" & FormatNumber ((endtime-startime) *1000,3) & "milliseconds"
%>
The program executes 5 times (except for the first execution), and then averages the values. The test results are as follows:
| Defining variables |
Execution time |
Average Time |
| Whether |
1890ms |
1859ms |
1844ms |
1875ms |
1859ms |
1865ms |
| Is |
890ms |
890ms |
984ms |
875ms |
890ms |
905ms |
From the above test results, the definition of variables than the definition of variables, ASP's execution speed is one times faster.
As for why this is the case, I have not further in-depth study. But through this example, I do feel that spec programming makes the program run more efficiently. For nonstandard programming, the language itself is fault tolerant, but its analysis process takes time. Of course, for a simple program, perhaps the difference between the specification and the time it takes to not standardize is negligible, but if you develop a larger system, more pages, more function calls, then the specification and nonstandard their time difference will be highlighted, less 1, twice times, more than dozens of times times are not odd.