Answer the question
In order to leave comments, you need to log in
How fast are your php templating engines?
I tried to make an echo on Smarty2, everything took 0.5 seconds. Smarty3 is faster? Can someone tell me how much?
Do you have any speed data for Twig?
require '../libs/Smarty.class.php';
$smarty = new Smarty;
$smarty->template_dir = 'templates';
$smarty->compile_dir = 'templates_c';
$smarty->compile_check = true;
$smarty->debugging = true;
//Создадим переменную для примера
$name1 = 'V1';
$name2 = 'V2';
$name3 = 'V3';
//Передаем переменную в шаблонизатор Smarty
$smarty->assign('name1',$name1);
$smarty->assign('name2',$name2);
$smarty->assign('name3',$name3);
//Выводим шаблон на экран
$smarty->display('main.tpl');
Answer the question
In order to leave comments, you need to log in
Purely personal opinion:
1) Pure PHP itself is an excellent template engine.
2) The response time of a web page is critical for both user perception and search engine ranking.
Ideally, you need to keep within 50ms. More than 150-200ms problems may begin.
In these realities, spending 100-150ms of script work on a template engine that does not actually introduce any fundamentally new functionality is bad practice.
In some cases Smarty or Twig is an overhead.
There are simpler templates. For example, websun on this meaningless "hello world" task "renders" the page in about 0.0013 seconds.
And on more real pages from 0.03 to 0.16 seconds (although here I did not count a pure render, but a full genset with all requests).
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question