In the all-around space, the asp.net/php/aspability can be better tested and analyzed, and some samples can be referenced.
Below is my test record today.
Test equipment and EnvironmentTest Device: self-use laptop Test System: Windows Server 2003 Enterprise Edition running environment: IIS6.0
Test MethodExecute 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" %> |
To obtain more reasonable data, the execution result is executed five times each time (except for the first execution), and then the average value is obtained. 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 consumptionThe following describes the system resource consumption during the execution of each program, mainly the instantaneous values of cpu and memory. 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 during testing, the notebook did not close all other running programs, so this memory is not the value consumed by this program ). When php executes a program, the peak cpu usage increases to 75%, and the memory usage is 1.03 GB. When asp executes a program, 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.