Poor php performance? Solution

Source: Internet
Author: User
Poor php performance? I am a beginner in php. I used php to perform a simple test: & lt ;? Php $ time_start = explode (& quot;, microtime (); $ count = 0; for ($ I = 1; $ I <10000; $ I ++) {for ($ j = 1; $ j & lt; 10000 poor php performance?
I am a beginner in php. I did a simple test using php:
$ Time_start = explode ("", microtime ());
$ Count = 0;
For ($ I = 1; I I <10000; $ I ++ ){
For ($ j = 1; $ j <10000; $ j ++ ){
$ Count = $ count + 1;
If ($ count % 1000000 = 0 ){
Echo $ count ."
";
}
}
}
$ Time_end = explode ("", microtime ());
$ C = $ time_end [0] + $ time_end [1]-$ time_start [0]-$ time_start [1];
Echo" Run time: ". $ c." seconds ";
?>
Running time: 35.6164469719 seconds
Similar jsp pages are used for the same test.
<%
Long time_start = new Date (). getTime ();
Long count = 0;
For (int I = 0; I <10000; I ++ ){
For (int j = 0; j <10000; j ++ ){
Count = count + 1;
}
If (count % 1000000 = 0 ){
Out. println (count +"
");
}
}
Long end_time = new Date (). getTime ();
Double time = (double) (end_time-time_start)/1000;
Out. println ("
");
Out. println ("time:" + time );
%>
The running time is 0.265 seconds.
Is php performance really so poor?

------ Solution --------------------
Whether it's slow or not, as long as the user experience is not slow after the code is written ··
------ Solution --------------------
Discussion
Whether it's slow or not, as long as the user experience is not slow after the code is written ··

------ Solution --------------------
Test cycle has no practical value

Test speed, response time of the page, customer experience, server load, memory usage, network throughput, and parallel quantity.

However, php is an interpreted language, and the speed is not the fastest. every request must be loaded, analyzed, run, and exited. Therefore, it is best to install a cache extension, xcache or eaccelerator.
------ Solution --------------------
Discussion
Reference:
Don't come up and talk about the face of the person you lose. you can see the problem clearly and then say, stupid guy!

In your words, all people dissatisfied with China should go abroad, right?
This is just a world view problem among new people. it is not to say that php is the only thing to talk about, but to clarify the truth, this is a quality problem, rather than creating contradictions.

------ Solution --------------------
Five years ago, I heard that asp is falling behind and I am about to get rid of something. but so far, I can still see asp programmers at any time. There are still a lot of websites using asp. Everyone has different opinions on a programming language. PHP programmers start their PHP programmer career immediately because they think PHP is better than others, or it is easy to get started, or for any other reason, the same is true for java and C.

Therefore, if you think JSP is better than PHP, you can use JSP instead of PHP. if you think ASP is better than PHP, you can also use ASP for development.
You think the performance is poor... If it is worse, you can write a letter to ldorf, the father of PHP, saying that PHP performance is too poor and you want to change it.
------ Solution --------------------
Haha! Very popular posts

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.