All frameworks are by definition slower than no-code as there’s more going on.
i.e.
<?php
echo 'metro';
is going to be much faster than a Slim application with this code:
use \Slim\App;
$config = include 'Config/Container.php';
$app = new App($config);
$app->get('/metro', function($request, $response){
return $response->write("metro");
});
$app->run();
This is because the Slim application is doing a lot more to enable it to respond to different URLs (routing) and handle error situations. That is the first block of code will not send back a 404 if you go to the /foo
URL.
To compare, you need to make the “non-framework” version have the same functionality as the Slim version. The performance difference will be much smaller.
solved Rest API w with SlimPhp take too much time