A
A
amiak2015-06-26 16:35:52
Yii
amiak, 2015-06-26 16:35:52

Why does a Yii2 view take a long time to render when using activeform?

<?php
use yii\helpers\Html;
use yii\widgets\ActiveForm;
?>

    <?php $form = ActiveForm::begin(['id' => 'test-form']); ?>
    <?= $form->field($hostnames, 'test')->input('test')?>
    <?= Html::submitButton('Submit') ?>
    <?php ActiveForm::end(); ?>

Drawing such a view takes about 1.2 seconds, while drawing the same view on pure html takes 0.1 seconds. How to solve this problem?
Yii 2.0.4 minimal build (no bootstrap)

Answer the question

In order to leave comments, you need to log in

5 answer(s)
M
Michael, 2015-06-26
@scherbuk

Why, the view takes a long time to render for you xs, but I had a long connection to the database

T
titronfan, 2015-06-26
@titronfan

Try changing the form, for example:

<?php $form = ActiveForm::begin(['id' => 'test-form']); ?>
<?php ActiveForm::end(); ?>

See how it goes in time.
Does the $hostnames variable quickly come into form?

V
Vladislav Bushuev, 2015-06-26
@redstar

On the standard advanced application, I froze. There are 3 queries per page.
site/index -> 8ms/9ms/13ms
site/contact -> 13ms/12ms/15ms
site/login -> 10ms/13ms/10ms.

A
Alexander David, 2015-06-26
@alexdevid

maybe due to the fact that ActiveForm additionally pulls up assets that are copied to assets + loaded on the page.
I don't remember if he did or not though.

A
amiak, 2015-07-07
@amiak

Thanks to all. It turned out the problem is in the PC, at home everything is smart.

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question