I'm just finishing up my first D8 development and looking to refine the performance of the site.

Surprisingly I'm seeing some pretty scary processing time of twig templates by webprofiler. An uncached page has >7000ms of twig processing which is mostly consumed by views-view.html.twig, views-view-unformatted.html.twig and a node template. The best cached performance still sees twig consuming 500ms and a page load is around 1300-1600ms.

With BigPipe turned on I can achieve 400ms twig, page load of 1000ms.

This is on an idle 4 core server.

Is this what I should be expecting? A D7 site on the same server is seeing 200ms page loads with a similar use of views and entities displayed.

I've really struggled to find any good information about twig/drupal performance so any insight into what could be causing this would be much appreciated.

Comments

Jeff Burnz’s picture

Are you sure twig is not in debug mode, that is very slow and not normal.

dkre’s picture

Yep, I'm not seeing a whole lot of difference between debug on vs off on the first page load with a cold cache.

Jeff Burnz’s picture

I've not used this webprofiler a whole lot, but I do notice that the times for an anon logged out user cannot be right, e.g. for me I'm getting 60ms for html.html.twig logged in, but over 6000ms logged out, where the page loads are so fast you barely notice, they're just wrong, 6 seconds you will notice - is this the same issue? If not I think you have dig and see whats causing the problems.