Number word speak, shock: TP frame, php,html,php static page execution efficiency analysis and comparison!

Source: Internet
Author: User
Digital speaking, Shock: TP frame, php,html,php static page execution efficiency analysis and comparison!!

Recently intends to do a high-performance chat server, do not know how Thinkphp3.2 efficiency? So what is the efficiency of the framework? So the test.
Task: Reads 44 data from the database.
1, Tp3.2 Home->controler->indexcontroler->index ()
$m =m (' Login_log ');
$login _log_list= $m->select ();
$this->assign (' login_log_list ', $login _log_list);
$this->display (' index ');
Template: index.html: Using tags Show.

2, test2.php (Core code:)
$result =mysql_query (' select * from Login_log ');
while ($item =mysql_fetch_assoc ($result))
3, test2.html: is test2.php output result.
4, test1.php: is the suffix of test2.html to PHP, and nothing else changes.

Adoption Tool: Ab.exe performs 1000 connections, 100 concurrent. PC: ASUS notebook cpu:u3400 6G memory. Win7. All programs are executed locally.
The results are as follows:

Results: http://chenrenqi.blog.sohu.com/303865454.html
The chart is not supported here, please see the above link.

This shows: the native PHP connection database, is TP3.2 11 times times. Time is mainly spent on file loading and class building, and template parsing.
The static file is about 21 times times the PHP connection database file. is about 4 times times the size of PHP after you change the suffix.
To know, the actual work of a PHP file. That is, an HTTP connection, which may require multiple database connections, the actual HTML may be more than 30 times times faster than PHP, is very normal.

------to solve the idea----------------------
Back to your post. · That's it. • The framework of things to instantiate a lot of useless things, but just to achieve a very small function, MVC framework • Every time the page is refreshed to the beginning and end of the instantiation, so ... Pursuit of high performance ... The traditional process of writing may be more refreshing ... As for development efficiency and maintenance issues • is the main consideration of the building •
------to solve the idea----------------------
Thanks for sharing, however, this is a bit of common sense for PHP developers to understand, not to mention the development of high-performance applications people.
------to solve the idea----------------------
I think this test is not fair ah, for the framework of a set of mature caching mechanism?
And where did TP spend all the time? Disk IO? Instantiate object Write memory? Template rendering regular match?
These can all be done through the cache.
------to solve the idea----------------------
Haha, the landlord hair I think is to share the spirit, squirt die! Support landlord
------to solve the idea----------------------
A real programmer should write native.

There is a framework, because the framework can greatly advance the development speed. Quickly build projects.

But I do not think so, some sites, and framework logic inconsistent, with the native faster.

such as TP, for the forum, if I want to do a portal page, need to complete similar to Sina's homepage effect.

At this time, with TP can exhausted you.
------to solve the idea----------------------
This look looks at me and I'm happy.

I belong to that 1% ... Most of the performance bottleneck in the MVC hyper-file deployment of disk IO, high concurrency is very uncomfortable, think of ways to open the opcode cache to solve, the test results will be a big change it
I am very interested in the 16 floor said 10 several requests the single page exactly belongs to which frame ...
In addition, the framework is only to provide a development model and some commonly used functional encapsulation, do the forum or Sina these business logic is the difference? Perhaps I have not done really do not understand, I hope the heroes have time to science and

Native PHP is bound to be faster than frames, but we can greatly reduce this gap by means of optimization
If the fraction second page speed gap is more important than the development model, we all use the assembly to engage in the Web bar ~

Although little brother experience, but also want to refute Xu big, the cache is not not self-confidence, but the high frequency of repetitive work consumption to a minimum
A simple news, write operation may only once a lifetime, but read operations every minute in progress, do not need to let the server software run scripts, and then find the database to things, direct static file speed much faster, as if static files can still be optimized, the original hard disk-memory-the intermediate steps of the NIC buffer can also be omitted
Some of the more complex filter recommendations of the news, it is not necessary to let the database calculation every time
Of course the excessive cache must be superfluous


------to solve the idea----------------------

In fact, I am to turn the map, high concurrency of things, you can consider changing other languages. Efficiency also needs attention, but to the efficiency of the spray is not necessary.
------to solve the idea----------------------
Yes, TP is suitable for the forum community, information some small web site, not suitable for large-scale website, also never expect TP to bigger projects
------to solve the idea----------------------
There is time to test the efficiency of Yii.
------to solve the idea----------------------
The frame is also used, but in some places it is inconvenient,
For example: Multi-conditional query after pagination how to continue to get search conditions, TP here is very troublesome, get multiple data to cycle several times, not necessarily can get to!
------to solve the idea----------------------
Chat room the words node. JS can think about
  • Related Article

    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.