Twig extensions optimization