Performance optimisation

  1. Introduction
  2. Use DQL Joins
  3. Use the Twig service
  4. Use namespace notation for templates

Introduction

This document collects some developer hints for improving performance of your code.

Use DQL Joins

Doctrine fetches related items lazily by default. While this saves performance in cases you do not need them, this behaviour becomes worse if you access a few relationships though. The reason is that several single queries are slower than one combined query.

So if you know that you need access to some relationships add corresponding DQL joins to your query builder. Read more about this here.

Use the Twig service

Since Zikula always uses Twig templates you should use the twig service instead of the templating abstraction. The latter is just overhead we do not need.
Read more about this here.

Use namespace notation for templates

You must always use namespaced pathes for your templates which is faster than the normal notation because Twig does not need to convert it when resolving/reading the template file.

So for example use @AcmeFooModule/Person/index.html.twig instead of AcmeFooModule:Person:index.html.twig.