🔥

CodeIgniterとLaravelをざっとベンチマークしてみる

2022/04/28に公開2

環境

  • macOS 10.15.7
  • PHP 8.0.18
  • symfony server (Symfony CLI) 5.4.8

ベンチマーク対象

  • CodeIgniter 4.1.9
  • Laravel 9.10.0

インストール

$ composer create-project codeigniter4/appstarter codeigniter
$ cd codeigniter/
$ composer update --no-dev
$ composer create-project laravel/laravel laravel
$ cd laravel/
$ composer update --no-dev

ベンチマークの実行

CodeIgniter

$ cd codeigniter/
$ symfony server:start
$ ab -c 10 -t 3 http://127.0.0.1:8000/
This is ApacheBench, Version 2.3 <$Revision: 1879490 $>
Copyright 1996 Adam Twiss, Zeus Technology Ltd, http://www.zeustech.net/
Licensed to The Apache Software Foundation, http://www.apache.org/

Benchmarking 127.0.0.1 (be patient)
Finished 350 requests


Server Software:        
Server Hostname:        127.0.0.1
Server Port:            8000

Document Path:          /
Document Length:        18227 bytes

Concurrency Level:      10
Time taken for tests:   3.000 seconds
Complete requests:      350
Failed requests:        32
   (Connect: 0, Receive: 0, Length: 32, Exceptions: 0)
Total transferred:      6438216 bytes
HTML transferred:       6379416 bytes
Requests per second:    116.66 [#/sec] (mean)
Time per request:       85.719 [ms] (mean)
Time per request:       8.572 [ms] (mean, across all concurrent requests)
Transfer rate:          2095.67 [Kbytes/sec] received

Connection Times (ms)
              min  mean[+/-sd] median   max
Connect:        0    0   0.1      0       1
Processing:    27   84  13.7     82     147
Waiting:       26   82  13.8     81     147
Total:         27   84  13.7     82     148

Percentage of the requests served within a certain time (ms)
  50%     82
  66%     86
  75%     90
  80%     93
  90%    101
  95%    108
  98%    120
  99%    130
 100%    148 (longest request)

Laravel

$ cd laravel/
$ symfony server:start
$ ab -c 10 -t 3 http://127.0.0.1:8000/
This is ApacheBench, Version 2.3 <$Revision: 1879490 $>
Copyright 1996 Adam Twiss, Zeus Technology Ltd, http://www.zeustech.net/
Licensed to The Apache Software Foundation, http://www.apache.org/

Benchmarking 127.0.0.1 (be patient)
Finished 133 requests


Server Software:        
Server Hostname:        127.0.0.1
Server Port:            8000

Document Path:          /
Document Length:        17593 bytes

Concurrency Level:      10
Time taken for tests:   3.024 seconds
Complete requests:      133
Failed requests:        0
Total transferred:      2485238 bytes
HTML transferred:       2339869 bytes
Requests per second:    43.98 [#/sec] (mean)
Time per request:       227.394 [ms] (mean)
Time per request:       22.739 [ms] (mean, across all concurrent requests)
Transfer rate:          802.48 [Kbytes/sec] received

Connection Times (ms)
              min  mean[+/-sd] median   max
Connect:        0    0   0.3      0       3
Processing:    56  210  54.1    206     463
Waiting:       56  209  54.1    206     462
Total:         57  210  54.1    206     463

Percentage of the requests served within a certain time (ms)
  50%    205
  66%    225
  75%    232
  80%    236
  90%    262
  95%    281
  98%    306
  99%    454
 100%    463 (longest request)

結果

Requests per second
CodeIgniter 4.1.9 116.66
Laravel 9.10.0 43.98

おまけ

du コマンドによるディスク使用量の比較。

5.4M codeigniter/
 37M laravel/

Discussion

Taka OyamaTaka Oyama

Laravel は php artisan optimize 実行するとそこそこ改善します。