myaaghubi / PHP-Frameworks-Bench

A library to make benchmarks from PHP frameworks.
GNU General Public License v2.0
109 stars 4 forks source link

Some microframeworks hardcode the URL prefix #14

Closed joanhey closed 1 year ago

joanhey commented 1 year ago

Like say in the README: Used the default configuration

So before hand no framework know the URL, but some microframeworks have hardcoded the prefix for this exact benchmark.

Frameworks with this advantage:

The rest need to calculate the prefix in each request.

myaaghubi commented 1 year ago

The purpose is to make them work! sub-dir & no .htaccess

fastroute (mentioned in comment) https://github.com/myaaghubi/PHP-Frameworks-Bench/blob/e710ff7e84559d0f5ebdda2d46331059acdb2945/fastroute-1.3/index.php#L23-L28 The same thing for phroute, for slim 4.x $app->setBasePath, framework-x has been removed 748950e383d3d04180f20c106c976c0acdde6c3d

joanhey commented 1 year ago

Yes, I know that they need it to work. Also any full framework need it, but they calculate it in each request. They need it to create the links to the app and assets.

I only say that they need to calculate it too.

The link: https://github.com/nikic/FastRoute/issues/110#issuecomment-273760186 show some functions, to make automatic detection, that the rest of frameworks need to do it.

PD: another temporal solution is to add notes, at the end of the table, like did Kenjis image

myaaghubi commented 1 year ago

For the second note, we are no longer limited to ab.

For the first note:

myaaghubi commented 1 year ago

The link: nikic/FastRoute#110 (comment) show some functions, to make automatic detection, that the rest of frameworks need to do it.

Also that function is not included in fastroute so I put that part.

joanhey commented 1 year ago

I only show the 2 notes of Kenjis as example. For add to this bench, any note that is relevant.

PD: The phalcon.so and ice.so, you don't need to run it in parallel, if you install any of these extensions, all PHP is ~10% slower. (Almost some years ago) So in any benchmark, it need to install the extension isolated,.

myaaghubi commented 1 year ago

For add to this bench, any note that is relevant.

Do you mean wiki?

The phalcon.so and ice.so, you don't need to run it in parallel, if you install any of these extensions, all PHP is ~10% slower.

These are extensions -pre-compiled and needed to load first- my point is about the frameworks, different story It actually depends on the hardware, less than 10%

myaaghubi commented 1 year ago

I may put some notes for developers to add their libs in, however, it is generally explained in the video (README.md). But considering the title it is not a good idea to ask them not to hard code. There is an exception here pure-php, which I made, the point is to have a very simple hello world (small minimum bootstrap cost) not to have a remarkable lib

joanhey commented 1 year ago

I think that will be not exceptions. You need to move it to other dir and still work.

Only calculate it like the rest of frameworks do.

myaaghubi commented 1 year ago

It is working just like other libs, with no diff, the source code is available. You can't ask me to force other libs/frameworks/routingsystems to not hard code the URL prefix but you may ask me to not hard code the URL prefix for pure-php unlike others, this is the exception I mentioned, and it is not accepted since the pure-php is not a competitor, the purpose of it is to show without a lib how fast a hello world can be