当前位置:网站首页>Performance test comparison between PHP framework jsnpp and thinkphp6
Performance test comparison between PHP framework jsnpp and thinkphp6
2022-06-26 04:20:00 【hengaogjh】
Studying recently Jsnpp frame , This framework is not only syntactically simple and easy to use , And the initial feeling is that the execution speed is quite fast , To confirm , So I did this test .
Obviously , The test has a frame of reference , Testing without reference is meaningless , Because the hardware environment is different , Then the test results are different . So first you have to select a reference system , because Jsnpp The frame is PHP The framework of language implementation , So use c The framework of language extension cannot be used as a frame of reference , You need to choose one that is also PHP The framework of language implementation .Laravel It's more popular PHP frame , But its performance is known to be relatively low , The results should be known without comparison . and thinkphp relative Laravel Better performance , So I plan to take it first thinkphp Let's compare .
meanwhile , This test will also use native PHP As a reference , Take a look at the framework implementation , How much performance loss .
The test framework :
Jsnpp 4.7.0 ( Official website :http://www.jsnpp.com/)
thinkphp 6.0 ( Official website :https://www.thinkphp.cn/)
Test environment :
PHP7.1
The test environment was intended to use PHP8.1, But use composer download thinkphp6 in the future , in PHP8.1 The following cannot be used , So we used PHP7 To test .
Testing software :ab Software
Test method : Simulate 10000 visits ,200 Concurrent situation .
Test process record :
1、 Download the latest version :
use first composer Download the latest version of Jsnpp and thinkphp, Here I set up folders in the same environment to store the downloaded source code ,Jsnpp Frame on “jsnpp” In the folder ,thinkphp Frame on “tp6” In the folder .
2、 Prepare the test code :
Because both frameworks use MVC Architecture design , Generally, the template engine will be used to display the page , So both test frameworks use templates . The content displayed on the page is “Hello World!”.
Jsnpp After frame Download , The default is to use the template engine , So there's no need to modify Jsnpp Controller file of the framework , Only need to “app/view/index/index.html” The content of this file is changed to “Hello World!” That's all right. .
thinkphp6 The framework is troublesome , You need to modify the controller file to the following code first :
namespace app\controller;
use app\BaseController;
use think\facade\View;
class Index extends BaseController
{
public function index()
{
return View::fetch('index');
}
public function hello($name = 'ThinkPHP6')
{
return 'hello,' . $name;
}
}Then add “app/view/index/index.html” This file , And the content is changed to “Hello World!”.
3、 To test :
Here are Jsnpp Test results of the framework :

Jsnpp The number of requests per second of the framework is basically maintained at 3600 about .
Here are thinkphp6 Test results :

Above is thinkphp6 The best test result , Others are basically in 3000 following , On average 2800 about . Back analysis , I use the best results of this time to illustrate , namely 3000 This data .

That's right thinkphp6 Another test of
4、 Native PHP Code testing :
I created a new one under the same level directory “php” Folder , Then put... In it “index.php” file , The contents of the document are as follows :
<?php
echo 'Hello World!';This is the use of PHP Simple output of native code “Hello World!”.
Here are the test results :

Multiple tests ,PHP The native code is basically 4000 about .
5、 Conclusion :
Pass the above test , We can see ,Jsnpp The performance of the frame is obviously better than thinkphp6,Jsnpp The framework can achieve 3600, and thinkphp6 It can only reach 3000, It is equivalent to that under concurrent conditions ,Jsnpp The framework can be in thinkphp6 Improve the performance base 20% Performance of ,(3600 - 3000) / 3000 = 0.2.
Relative to native PHP Code for ,Jsnpp Less loss of frame performance , Only 10% Performance loss of ,(4000 - 3600) / 4000 = 0.1.
and thinkphp6 The performance loss reaches 25%,(4000 - 3000) / 4000 = 0.25.
Obviously , In terms of performance loss , What is the gap between the two 2.5 times , obvious Jsnpp The framework is much better than thinkphp6.
The above tests are based on desktop computers , Not a test on the server , The data in different hardware environments will change , But the relative data will not change much , The difference of test performance mainly depends on the relative data , The relative data under the same conditions can reflect the performance differences of different frameworks , This test is conducted in strict accordance with the same conditions , Only in this way can we get the correct conclusion .
边栏推荐
- NPM installation tutorial
- asp.net网页选择身份进行登录的简单代码,asp连接数据库,使用asp:Panel、asp:DropDownList控件
- What are the advantages and risks of paper gold investment
- Capture packets (Wireshark)
- Spark - understand parquet
- Understand CGI and fastcgi
- win10 系统打开的软件太小,如何变大(亲测有效)
- Wechat applet is bound to a dynamic array to implement a custom radio box (after clicking the button, disable the button and enable other buttons)
- Oracle 数据泵导表
- Introduction Guide to the flutterplugin plug-in in the actual combat of flutter
猜你喜欢

OSS CDN alicloud configuration method

一幅脑图总结一下需求分析(工作上实际遇到的情况的补充)

Clickhouse stand alone installation

The open software of win10 system is too small. How to make it larger (effective through personal test)

Microsoft prohibits Russian users from downloading and installing win10/11

Ten important basic principles of software debugging and testing

Matplotlib line chart, text display, win10

Mutex of thread synchronization (mutex)

6、 Project practice --- identifying cats and dogs

Tp6 controller does not exist: app\index\controller\index
随机推荐
Etcd watch principle
Which is the best embedded visual programming software? (introduction, evaluation and selection of visual programming platform) [scratch, mind+, mixly]
Install cenos in the virtual machine
Swagger
6、 Project practice --- identifying cats and dogs
What if the serial port fails to open when the SCM uses stc-isp to download software?
Knowledge of functions
Implementation of seven classes of BlockingQueue interface
線程同步之讀寫鎖
Analysis report on development trend and market demand of global and Chinese molecular diagnostics industry from 2022 to 2028
Computer network high frequency interview questions
线程同步之读写锁
CTF serialization and deserialization
Mobile terminal pull-down loading pull-down loading data
Matplotlib multi line chart, dot scatter chart
Using jsup to extract images from interfaces
After four years of outsourcing, people are directly abandoned...
VHDL设计
But the Internet began to have a new evolution and began to appear in a new state
After a test of 25K bytes, I really saw the basic ceiling