I'm currently developing a base application for my projects and something doesn't seem right.
First of all, I'm using PHP 7, Apache.
Composer is first called, it does its magic and all the goods. Then I register a Container (Illuminate) and at this point, the request is finished at about 8-11ms.
Now, when I add the HttpFoundation
component to the app, the performance loss is huge, jumping from 8-11ms to a staggering 80-95ms.
The pieces of code related to the HttpFoundation
component are presented below. It's nothing too complex; barely a few lines of code taken straight off the Symfony documentation.
use Symfony\Component\HttpFoundation\Request;
use Symfony\Component\HttpFoundation\Response;
$request = Request::createFromGlobals();
$input = $request->get('name', 'World');
$response = new Response();
$response->setContent('Hello, ' . $input . '!');
$response->setStatusCode(200);
$response->headers->set('Content-Type', 'text/html');
$response->send();
PHP info: http://pastebin.com/3kgAJ635
After conducting a small test on the same component alone (composer + HttpFoundation), the results yield an average of 60ms. What is going on with Symfony's standalone components?