Home  >  Article  >  PHP Framework  >  A brief analysis of the performance comparison of laravel, lumen and tp frameworks

A brief analysis of the performance comparison of laravel, lumen and tp frameworks

青灯夜游
青灯夜游forward
2022-06-01 11:40:503679browse

Each framework has its own advantages and disadvantages. Laravel is relatively bloated, but it integrates many functions, such as the complete Artisan command line, ORM model, observer, listener, easy-to-use di container to implement dependency injection, etc. There are also many ecological extensions.

For tp, I only used the tp3.2 version at the earliest, and later I only had some understanding of tp5. Recently I discovered that tp6 has been released, and it is more similar to laravel. It has also developed the think command line and ORM model, and even the usage of ORM is similar. Didn't look at the others in detail.

Because I have always known that the disadvantage of laravel is that its performance is slower because it loads more things, so how much slower is it? Here is a simple test to see.

Comparison

The three frameworks for comparison are:

  • laravel

  • tp

  • lumen

100,000 pieces of data have been inserted into the database in advance. Take a look at the performance comparison of the top ten items.

laravel7

Let’s take a look at the running results of the laravel framework.

A brief analysis of the performance comparison of laravel, lumen and tp frameworks

A brief analysis of the performance comparison of laravel, lumen and tp frameworks

A brief analysis of the performance comparison of laravel, lumen and tp frameworks

A brief analysis of the performance comparison of laravel, lumen and tp frameworks

#You can see that the average is about 150- 160ms. In fact, I measured it many times. I just took a few screenshots. If you are interested, you can test it and I will correct it if I am wrong hahaha.

lumen

Let’s take a look at lumen. As a lightweight laravel, lumen has deleted many functions. It is indeed much faster.

Because Lumen removes the ORM by default, you need to uncomment the ORM in the bootstrap/app.php startup file.

$app->withEloquent();

Okay, let’s take a look at the results.

A brief analysis of the performance comparison of laravel, lumen and tp frameworks

A brief analysis of the performance comparison of laravel, lumen and tp frameworks

A brief analysis of the performance comparison of laravel, lumen and tp frameworks

It can be seen that the average time consuming of lumen is about 80ms, compared with laravel Nearly double the performance.

tp6

tp6 test results.

A brief analysis of the performance comparison of laravel, lumen and tp frameworks

A brief analysis of the performance comparison of laravel, lumen and tp frameworks

A brief analysis of the performance comparison of laravel, lumen and tp frameworks

You can see that the average time consumption of tp6 is about 100ms, which is faster than laravel, but Slower than lumen.

The test results for the three frameworks are roughly like this. It is just a simple test. If there are tests for other frameworks, please @me or send them to me and I will make up for them.

Because the test results are the results of hand testing rather than pressure testing, the test results are for reference only.

Basically it can be seen that the minimum time consumption of laravel is about 130, the maximum time is about 200, and the average time is 160.

tp6 has a minimum of around 80, a maximum of around 120, and an average of around 100.

lumen has a minimum of around 50, a maximum of around 100, and an average of around 80.

But I believe that when the business becomes larger and more complex and various functions need to be introduced, even using tp or lumen will take more time and require a longer development cycle. Of course, if the business is simple, it can be completed using a simple framework.

【Related recommendations:

laravel video tutorial, thinkphp framework

The above is the detailed content of A brief analysis of the performance comparison of laravel, lumen and tp frameworks. For more information, please follow other related articles on the PHP Chinese website!

Statement:
This article is reproduced at:爱代码爱编程. If there is any infringement, please contact admin@php.cn delete