Silex, Symfony2 FormServiceProvider - SLOW

from time to time I try to use Symfony FormServiceProvider and always have problems with speed, the witch actually stops me from moving forward.

1.1 simple form of twig - Lead time: 0.28957605361938

$app->match('/test2', function (Request $request) use ($app) {
    return $app['twig']->render('form.html');
});

1.2 Provider Registration FormServiceProvider, TranslationServiceProvider - Runtime: 0.36547303199768

2.1 registration of providers FormServiceProvider, TranslationServiceProvider and build form - lead time: 1.0038349628448

$app->match('/test1', function (Request $request) use ($app) {
$choices = array('1'=>'Mr.', '2'=>'Miss', '3'=>'Mrs.');
$data = array(
    'name' => 'my firstName',
    'email' => 'my lastName',
);

$form = $app['form.factory']->createBuilder('form', $data)
    ->add('name')
    ->add('title', 'choice', array('choices'=>$choices))
    ->add('email')
    ->add('gender', 'choice', array(
        'choices' => array(1 => 'male', 2 => 'female'),
        'expanded' => true,
    ))
    ->getForm();

$form->handleRequest($request);

return $app['twig']->render('index.html', array('form' => $form->createView()));
});

Woooow !!! 1 sec !!! 3-4 SPEEDS OF TIME !!! Is this supposed to be so slow - or am I doing something wrong? tests performed on my osx dev env virtual kernel 1024 MB RAM, 2 cpu

+4

Source: https://habr.com/ru/post/1535259/


All Articles