Thomas,

I think this is due to a bug in Symfony, see 
https://github.com/symfony/symfony/issues/6919.

The second solution checks less files because it does not support template 
inheritance. 

Cheers,
Victor

On Sunday, June 2, 2013 1:13:01 PM UTC+2, Thomas wrote:
>
> Hello,
>
> I have done a few strace on a php-fpm while rendering a standard symfony 
> action. The strace shows one interesting thing about how symfony + twig try 
> to resolve template location.
>
> From the documentation, h
> ttp://symfony.com/doc/master/book/templating.html#template-naming-locations<http://symfony.com/doc/master/book/templating.html#template-naming-locations>,
>  
> the documented way to define a template is to use colon notation. This 
> notation generates extra IO and does not seems to use the templates.php 
> cache file at first.
> *
> *
> *Template name: @SonataUserBundle:Admin:Security/login.html.twig*
> stat("/vagrant/sandbox/app/Resources/views/SonataUserBundle:Admin:Security/login.html.twig",
>  
> 0x7fffd33c8420) = -1 ENOENT (No such file or directory)
> stat("/vagrant/sandbox/vendor/symfony/symfony/src/Symfony/Bridge/Twig/Resources/views/Form/SonataUserBundle:Admin:Security/login.html.twig",
>  
> 0x7fffd33c8420) = -1 ENOENT (No such file or directory)
> stat("/vagrant/sandbox/vendor/knplabs/knp-menu/src/Knp/Menu/Resources/views/SonataUserBundle:Admin:Security/login.html.twig",
>  
> 0x7fffd33c8420) = -1 ENOENT (No such file or directory)
> access("/vagrant/sandbox/app/Resources/ApplicationSonataUserBundle/views/Admin/Security/login.html.twig",
>  
> F_OK) = -1 ENOENT (No such file or directory)
> access("/vagrant/sandbox/src/Application/Sonata/UserBundle/Resources/views/Admin/Security/login.html.twig",
>  
> F_OK) = -1 ENOENT (No such file or directory)
> access("/vagrant/sandbox/app/Resources/SonataUserBundle/views/Admin/Security/login.html.twig",
>  
> F_OK) = -1 ENOENT (No such file or directory)
> access("/vagrant/sandbox/vendor/sonata-project/user-bundle/Sonata/UserBundle/Resources/views/Admin/Security/login.html.twig",
>  
> F_OK) = 0
>
> However, there is another notation (The one use in the Symfony Profile) 
> which does not generated extra IO
>
> *Template name: @SonataUser/Admin/Security/login.html.twig*  
> stat("/vagrant/sandbox/vendor/sonata-project/user-bundle/Sonata/UserBundle/Resources/views/Admin/Security/login.html.twig",
>  
> {st_mode=S_IFREG|0644, st_size=1564, ...}) = 0
> stat("/vagrant/sandbox/app/cache/prod/twig/a8/e6/51a3ddff7ccaf9e1a0ef99ab2a9f.php",
>  
> {st_mode=S_IFREG|0664, st_size=4060, ...}) = 0
>
> I also find another I/O check in the Twig_Loader_Filesystem::addPath 
> (is_dir) method. The check must be done will using twig as a standalone 
> component, however the TwigBundle already check path inside the Extension, 
> so the Symfony\Bundle\TwigBundle\Loader\FilesystemLoader should overwrite 
> the addPath method. This can save up to 1 I/O check per bundle.
>
>
> Note: The strace have been done on a env ready for production: composer 
> dump-autoload -o / apc.stat = Off / warm-cache --env=prod. 
>
> --
> Thomas Rabaix
> [email protected] <javascript:>
>
>
>
>  
>

-- 
-- 
If you want to report a vulnerability issue on Symfony, please read the 
procedure on http://symfony.com/security

You received this message because you are subscribed to the Google
Groups "symfony developers" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to
[email protected]
For more options, visit this group at
http://groups.google.com/group/symfony-devs?hl=en
--- 
You received this message because you are subscribed to the Google Groups 
"Symfony developers" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
For more options, visit https://groups.google.com/groups/opt_out.


Reply via email to