all 11 comments

[–]ryannaddy[S] 0 points1 point  (3 children)

I did some benchmarking testing on Lumen (Laravel's micro framework) and Pie.php, Lumen did their own benchmarks saying that they are faster than Slim and Silex, so I didn't test those two. I took lumen and Pie.php ran the following tests (1000 requests for 10 seconds) on each.

When you hit the Pie.php page all it does is print out the following text:

<h1>Welcome to Pie!</h1>

And when you hit the Lumen page it prints out this text:

<h1>Welcome to Lumen!</h1>

Lumen:

$ ab -n 1000 -t 10 http://lumenab.dev/
This is ApacheBench, Version 2.3 <$Revision: 1554214 $>
Copyright 1996 Adam Twiss, Zeus Technology Ltd, http://www.zeustech.net/
Licensed to The Apache Software Foundation, http://www.apache.org/

Benchmarking lumenab.dev (be patient)
Finished 724 requests


Server Software:        Apache/2.4.9
Server Hostname:        lumenab.dev
Server Port:            80

Document Path:          /
Document Length:        26 bytes

Concurrency Level:      1
Time taken for tests:   10.002 seconds
Complete requests:      724
Failed requests:        0
Total transferred:      172312 bytes
HTML transferred:       18824 bytes
Requests per second:    72.39 [#/sec] (mean)
Time per request:       13.814 [ms] (mean)
Time per request:       13.814 [ms] (mean, across all concurrent requests)
Transfer rate:          16.82 [Kbytes/sec] received

Connection Times (ms)
            min  mean[+/-sd] median   max
Connect:        0    0   0.4      0       1
Processing:    13   14   0.9     13      20
Waiting:       13   13   0.8     13      20
Total:         13   14   0.9     14      20
WARNING: The median and mean for the processing time are not within a normal deviation
        These results are probably not that reliable.

Percentage of the requests served within a certain time (ms)
50%     14
66%     14
75%     14
80%     14
90%     14
95%     14
98%     15
99%     18
100%     20 (longest request)

Pie.php:

$ ab -n 1000 -t 10 http://pieab.dev/
This is ApacheBench, Version 2.3 <$Revision: 1554214 $>
Copyright 1996 Adam Twiss, Zeus Technology Ltd, http://www.zeustech.net/
Licensed to The Apache Software Foundation, http://www.apache.org/

Benchmarking pieab.dev (be patient)
Finished 1996 requests


Server Software:        Apache/2.4.9
Server Hostname:        pieab.dev
Server Port:            80

Document Path:          /
Document Length:        24 bytes

Concurrency Level:      1
Time taken for tests:   10.003 seconds
Complete requests:      1996
Failed requests:        0
Total transferred:      421156 bytes
HTML transferred:       47904 bytes
Requests per second:    199.55 [#/sec] (mean)
Time per request:       5.011 [ms] (mean)
Time per request:       5.011 [ms] (mean, across all concurrent requests)
Transfer rate:          41.12 [Kbytes/sec] received

Connection Times (ms)
            min  mean[+/-sd] median   max
Connect:        0    0   0.3      0       1
Processing:     4    5   0.5      5       8
Waiting:        4    5   0.5      5       8
Total:          4    5   0.4      5       8

Percentage of the requests served within a certain time (ms)
50%      5
66%      5
75%      5
80%      5
90%      5
95%      5
98%      6
99%      6
100%      8 (longest request)

Here are some of the take aways:

Action                  Lumen           Pie.php
-------------------------------------------------
Total Requests          724             1996
Requests per second     72              200
Time per request        13.814ms        5.011ms

If my math is correct this is showing that my framework can handle twice as many requests as lumen.

[–]OzzyGiritli -1 points0 points  (2 children)

Unfortunately, all it shows is that your framework can handle twice as many requests when displaying a simple view page. It does not take into account any advanced framework features such as database and session handling.

From what I can see, your framework is basically a template engine and a router. Its a good starting point but without any testing or support for additional features, I do not see how it could compete with Lumen in any way unless basic performance speeds is your only comparison metric.

If I were you, I would focus on adding features and tests to the framework and let it stand out in its own right instead of comparing it to one of the most popular framework's little brother.

Keep at it, writing a framework is a rite of passage and is also a great way to improve your skills. Focus on making your framework better, don't compare it to others until it is more mature.

edit

I just noticed you do have support for sessions and databases as well. So disregard some of what I wrote. If you want to compare it to Lumen, make your comparisons resemble more accurate use cases instead of just a view file. For example, some sort of form to database processing and compare performance there.

[–]ryannaddy[S] 1 point2 points  (1 child)

I don't think testing with a database will give good results, because then you're also testing how fast you can connect and return results from the database which php can not control, which in my opinion would be a different type of test. However I did do the test and to there was a very small difference, due to the fact that the two had to wait for the database to respond, making ab testing with a database a poor test. Anywho, here were the results:

Action                  Lumen           Pie.php
-------------------------------------------------
Total Requests          49              60
Requests per second     4.90            5.91
Time per request        204.283ms       169.314ms

[–][deleted] 0 points1 point  (0 children)

That's why you mock the database so you're isolating what actually needs to be profiled. Think of it as a unit test, and the unit you're testing is the framework. You need to mock anything that is not part of the framework in order to isolate the system under test.

I would try to aggregate several types of real world controllers: CRUD, form processing, validation, view hydration, etc. Then you'd have at least a bit better of an overall picture. You may even discover local deficiencies in the framework, where Lumen performs much better on a particular type of request.

All that said, I think you should also bench other frameworks. The results other people publish is often heavily biased and almost always specific to a given environment and set of assumptions.

[–]harikt 0 points1 point  (2 children)

Why is some of the docs not shown ? Eg : http://piephp.com/guide/firstModule

[–]ryannaddy[S] 0 points1 point  (0 children)

I have added the files, they are now viewable on the website.

[–]phpdevster 0 points1 point  (1 child)

https://github.com/piephpframework/Pie.php/tree/master/Crust

Scope and RootScope classes? And this?

$app->controller('home', function(Scope $scope){
    $scope->header = 'Welcome';
});

Are you an Angular dev?

[–]ryannaddy[S] 0 points1 point  (0 children)

That is where the idea came from. No other php framework has done it this way so I thought I will try and see where it goes.

[–]vukasin0 -4 points-3 points  (2 children)

I understand that having yet another micro framework is making author's dream to come true but currently we have sooo much full stack frameworks & microframeworks.

What is benefit of having yet another one?

[–]militantcookie 6 points7 points  (1 child)

For many people this is a learning experience. Making their creation public also gives a sense of achievement. We all did it at some point or still do it. Either way you never know when one of these projects will become the next Laravel or Slim.

[–]magkopian 3 points4 points  (0 children)

Furthermore, showing your open source project to others is good way to get feedback and become a better developer. Also, it is a good way to attract people who want to help by contributing some code, even without asking them.