Digital speaking, Shock: TP framework, php,html,php static page execution efficiency analysis and comparison

Source: Internet
Author: User
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.


Reply to discussion (solution)

90% of enterprise sites, internal OA, a small number of concurrent visits. So with TP is still good. If the performance requirements are significant. Can be used in other.

Fried Rice again?
It is always known that the framework brings about high efficiency in development. The authors of the framework never deny that they are less efficient.
PHP suffix is bound to start a PHP parser into the (line) process, any code execution takes time
The same is true if the HTML suffix is changed to a php suffix, but only if the PHP parser finishes parsing the entire document and confirms that there are no PHP syntax components.

C language compiled machine instructions are 30% more than assembly language. But even at a time when resources were expensive, programmers chose the C language.
What is this for? The reason is that C is as simple as his name.

High-performance Chat server .... Your data does not indicate any problems.

Think TP bad can choose C or Java, like you can English, I have to let you speak French, you will?

The pursuit of efficiency, can be used in C-PHP exhibition? Or is your frame a C? PHP exhibition.

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 •

Fried Rice again?
It is always known that the framework brings about high efficiency in development. The authors of the framework never deny that they are less efficient.
PHP suffix is bound to start a PHP parser into the (line) process, any code execution takes time
The same is true if the HTML suffix is changed to a php suffix, but only if the PHP parser finishes parsing the entire document and confirms that there are no PHP syntax components.

C language compiled machine instructions are 30% more than assembly language. But even at a time when resources were expensive, programmers chose the C language.
What is this for? The reason is that C is as simple as his name.



You know, you don't know what you're saying. Understand the performance, the unspoken meaning will know how to program to optimize.

Think TP bad can choose C or Java, like you can English, I have to let you speak French, you will?


Slow is not necessarily bad. There is a problem with logic. It's like I say that someone who is beautiful doesn't mean he is capable.

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.

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.

Haha, the landlord hair I think is to share the spirit, squirt die! Support landlord

This should be a common problem in the framework.

99% people feel the performance bottleneck in the database, the test results show that the performance bottleneck is in the database, yes, but we are hard to change. We can change the parts do not neglect, in addition to the database, other parts of the program bottleneck will exist. And the difference is great!

Another thing is, since the framework is known to be very poor performance, why not change it?

I now make a new framework, the goal: very simple, very powerful, very fast, very stupid.
Intended to be overlooked by everyone's front end

Let's enjoy extremely fast development while also enjoying extreme speed.
Initial goal: is half the speed of native PHP (not sure whether it can be done, this is the goal).

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.


What are you happy about, man? ^_^
A set of mature caching mechanism?? are tested multiple times, without seeing how much the cache has.


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.



I also thought the cache had much effect, and the test results found that the cache did not have much effect.

Caching only shows an advantage if it is high concurrency.
Usually small website, do not need to do what cache.

In the same logic, the native code is much faster than the frame. This is because the framework is going to load too many things.

For example, a simple page, the native code directly parse the output, only need one request. But the framework often divides the page into more than 10 small pieces, and the request for light is more than 10 times times more.

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.

Then I'll be the 1%.
Note: The database is not specifically a file system-based SQL (that is, SQL, memory-based tables), and memory-based NoSQL

The framework itself is nothing bad, and the framework is a summary of development experience.
But frameworks are not good for frames.

Traditional multi-entry architecture, routing assignment is done by the Web server
And some frameworks for the so-called single-entry effect, hard to do what should be done by the Web server to do their own work.


Why is there an illegal phrase in this passage?

This test doesn't make any sense ....

Feel php more and more like a sibuxiang, not even as efficient as Python

The pursuit of efficiency, can be used in C-PHP exhibition? Or is your frame a C? PHP exhibition.


It has not been done yet, and may be done in the future.

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 something, 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


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.

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

There is time to test the efficiency of Yii.

You're the one that's free to do! The framework is for rapid development.

Born for rapid development, does not mean fast. These basic research is not clear, you are busy, also blind busy.
I've been developing a high-speed framework recently. Must be busier than you.

You're the one that's free to do! The framework is for rapid development.

I'm dizzy, and in my opinion the framework has nothing to do with developers but to improve development efficiency;
With a year frame even the most basic SQL estimates are not written;
Not to mention the various initialization in the framework, the various new;

I'm dizzy, and in my opinion the framework has nothing to do with developers but to improve development efficiency;
With a year frame even the most basic SQL estimates are not written;
Not to mention the various initialization in the framework, the various new;


Originally you will be, originally not you will not.

There is time to test the efficiency of Yii.


The intention to use Yii also tested under, but the day before the study under, feel Yii author level is really too food. There's no need to test it.
Originally thought that yii is tall, understand, only then know is the rookie in silk.

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.


The level is also polar dish, within 1 years. Multi-programming bar. There's going to be progress.

It was quite shocking that a person with a decade of experience in web development could understand the cache.
It seems that these posts are purely a waste of my time, not reply landlord.

It was quite shocking that a person with a decade of experience in web development could understand the cache.
It seems that these posts are purely a waste of my time, not reply landlord.


By the right, where do you see people with 10+web experience? I'm up to 3 years old.

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!

Chat room the words node. JS can think about

Please use the assembly, if the efficiency is not standard, you can use the binary, if it is slow, I have no way

The first time I heard people say that Yii sucks, TP is very tall on the saying. I can only hehe, do not come out to install the Force, okay?

  • 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.