Php framework-If PHP is a pure PHP program, will the performance of non-nested HTML be higher?

Source: Internet
Author: User
Well, the problem is like a question. If the PHP program does not nest HTML code, it is a pure PHP program. It only processes data in the database or images, and does not nest html code, is the execution efficiency much higher? Here is a description: {code ...} {code ...} well, the problem is like a question. If the PHP program does not nest HTML code, it is a pure PHP program. It only processes data in the database or images, and does not nest html code, is the execution efficiency much higher?

Here is a description:

Yes. I will hand over rendering to the front end for processing. The backend php only provides services and transmits the data through JSON.
Here, I have answered my own question: I personally tested it. If php is just a pure operation and does not need to parse MVC, the efficiency will be higher, but it is not as high as we think, and there will be no saying that it is almost two or three times as high as we think. However, completely separating the front and back ends is particularly beneficial to development.

Reply content:

Well, the problem is like a question. If the PHP program does not nest HTML code, it is a pure PHP program. It only processes data in the database or images, and does not nest html code, is the execution efficiency much higher?

Here is a description:

Yes. I will hand over rendering to the front end for processing. The backend php only provides services and transmits the data through JSON.
Here, I have answered my own question: I personally tested it. If php is just a pure operation and does not need to parse MVC, the efficiency will be higher, but it is not as high as we think, and there will be no saying that it is almost two or three times as high as we think. However, completely separating the front and back ends is particularly beneficial to development.

What you call HTML Rendering is that php reads html template files or text strings and outputs them after processing.
What you call "only processing database data or image processing without nesting html code" may be omitted. Since there are omitted steps, the efficiency will definitely increase.

Of course, you replace the html Assembly step with the json Assembly step. Make sure that the performance of this step is no worse than before.

However, if the image data is not well designed, an http request will be sent one more time. If the design is poor, the speed may deteriorate.

HTML Rendering is not required, and the performance is certainly a little higher.
But are you sure you can "not render HTML?

The subject wants to completely separate the front and back ends? If yes, you can optimize the php server to improve efficiency.

Not high. php itself is a template written in c. The biggest advantage lies in nested html pure cpu computing, task scheduling, and io processing, which are all disadvantages of php.

The problem is whether it takes a long time to render the page or a long time to process the database.

This... this is not the legendMVCDesign Patterns!
Control LayerAndModel Layer,View LayerSeparated. The Controller is equivalent to an interface. It retrieves the corresponding model layer for data processing based on the data in the view layer!
Model LayerResponsibleBusiness Logic Operation,Control LayerResponsibleAllocate tasks and output data to the view layer, PlusopcodeCache,memcache,redisCache, my God!It's about to go.~

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.