As I'm writing this there's a big list of core theme functions and templates that are being converted to Twig templates. D8 will (hopefully) be going live with working Twig templates for all the markup it renders.

There's some performance issues around the Twig engine that need to be nutted out and it looks like the smallest Twig templates that have just one or two tags in them will be completely replaced with something else outside the theme system that's faster, but this should all be resolved sooner or later.

Until D8 ships we won't know what's a Twig template, what's been removed from the theme system and what's been converted to something else. Once it ships I think that in D9 there's a good opportunity for us to speed things up a little by taking every Twig template in core, writing an equivalent theme function for it that works with the existing preprocess function and renaming all the twig templates from "foo.html.twig" to "foo.html.twig.example" so they aren't called.

Why?

Because it will make everything that little bit faster to run "out of the box" and won't make life any harder for themers - they can continue to override whatever they want with templates and have solid working examples in core to reference (unless D8 ships with broken markup).

Comments

thedavidmeister’s picture

Issue tags: +Performance, +Twig
catch’s picture

Issue summary: View changes
Status: Postponed » Closed (works as designed)

Since we've completely deprecated theme functions in 8.x, and largely for improved security, I think this is 'by design' at this point.

I think for general theme layer performance, we should look at making a lot more work that's currently done up-front in preprocess lazy (converting pre-rendered string variables to wrapper objects for template bc maybe). Closing this out for now.

star-szr’s picture

+1 thanks @catch!

Version: 9.x-dev » 9.0.x-dev

The 9.0.x branch will open for development soon, and the placeholder 9.x branch should no longer be used. Only issues that require a new major version should be filed against 9.0.x (for example, removing deprecated code or updating dependency major versions). New developments and disruptive changes that are allowed in a minor version should be filed against 8.9.x, and significant new features will be moved to 9.1.x at committer discretion. For more information see the Allowed changes during the Drupal 8 and 9 release cycles and the Drupal 9.0.0 release plan.