Test and analyze the performance of asp.net/php/aspin in all-around space

Source: Internet
Author: User

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.

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.