Below is my test record today.
Test equipment and environment
Test device: self-use notebook
Test System: Windows Server 2003 Enterprise Edition
Running environment: IIS6.0
Test method
Execute the 10 million for loop with asp.net, php, and asp respectively to obtain the execution time. The following is the test code:
Asp.net
| The code is as follows: |
Copy code |
System. DateTime startTime = System. DateTime. Now;
For (long I = 1; I <10000000; I ++)
{
}
System. DateTime endTime = System. DateTime. Now;
System. TimeSpan ts = endTime-startTime;
Response. Write ("page Execution time:" + ts. Milliseconds. ToString ("0.000") + "millisecond "); |
Php
| The code is as follows: |
Copy code |
|
<? Php
$ Start_time = microtime (true );
For ($ I = 0; I I <10000000; $ I ++)
{
}
$ End_time = microtime (true );
Print "page Execution time:". round ($ end_time-$ start_time) *). "millisecond ";
?>
|
Asp
| The code is as follows: |
Copy code |
|
<%
Dim I
Dim startime
Startime = timer ()
For 1 to 10000000
Next
Dim endtime
Endtime = timer ()
Response. Write "page Execution time:" & FormatNumber (endtime-startime) *) & "millisecond"
%>
|
Execution result
In order to obtain more reasonable data, use each execution five times (except for the first execution), and then take the average value. The test results are as follows:
| Language |
Execution time |
Average time |
| Asp.net |
31 ms |
15 ms |
31 ms |
15 ms |
15 ms |
21 ms |
| Php |
1470 ms |
1473 ms |
1476 ms |
1467 ms |
1490 ms |
1475 ms |
| Asp |
812 ms |
828 ms |
812 ms |
812 ms |
828 ms |
818 ms |
According to the above test results, the execution time of asp.net is 70 times faster than that of php and 39 times faster than that of asp. I never thought of this test result.
System Resource consumption
The following describes the system resource consumption during the execution of each program, mainly the instantaneous values of cpu and memory.
Asp.net
When asp.net executes a program, the peak cpu usage increases to 10% and the memory usage is shown as 1.01 GB (note that the notebook did not close all other running programs during the test, so this memory is not the value consumed by this program ).
Php
When php executes a program, the peak cpu usage increases to 75%, and the memory usage is 1.03 GB.
Asp
When the asp program is executed, the peak cpu usage increases to 58%, and the memory usage is 1.06 GB.
Conclusion: in terms of system resource consumption, the advantages of asp.net are once again highlighted. It consumes much less cpu than php and asp, and php consumes more cpu than asp, but the difference is not big, but the consumption of memory is not big.