Deep EE Inspections, Joel Bradbury

Deep EE Inspections, Joel Bradbury Picture

Everything we do with ExpressionEngine leads to output of some form. Ever wondered exactly what is happening to transform our raw templates into fully assembled HTML? We look at exactly what’s happening under the hood, from the top of the stack fetching raw templates, pulling and parsing data, right down through all the execution layers to the bare metal. To do this we go through the existing tools we’ve got to help us, and introduce a new one that exposes EE’s inner workings in ways never before seen.


The EE Engine


User -> EE (talks to the DB) -> Outputs the website

Parts of EE

  • Core
  • Addons
  • Templates

All of them talk to the database.

CodeIngnitor - PHP Framework that EE is built on.

Core consists of:

  • Loader
  • Input
  • Output
  • Security
  • URI
  • more

Core Libraries:

  • member
  • session
  • template
  • view

Core Models:

  • channel model
  • entries model
  • template model


  • 1st and 3rd party
  • Modules
  • Extensions
  • Fieldtypes
  • Plugins
  • Accessories


  • site itself
  • pull
  • parse
  • repeat
  • display

Around 8000 files make up the core.


Output Profiler

  • Lives at the top
  • Mainly used for the DB list, to see queries
  • Shows query and how long it took.
  • "Start the timer… Tick Tock Tick Tock…"
  • Once the profiler is run there is no way to tell why the queries are being run.

Template Logging

  • Lives at the bottom
  • Elapsed Time
  • Relative Execution Time
  • Memory Usage
  • Freeform text message
  • (implied execution order)

Caveat! - Logging points are optional

Graphite - Add-on that turns a template log into a graph.

Logs are great for add-ons that do external requests (Facebook, Twitter, etc.) to see how long they are taking. - Chat Room Comment

Problem with template logging: It's internal to the system.


Must go beyond the Output Profiler and Template Logging

XDebug - a php extension: Takes a standard error display which is obtuse and bland and makes it more readable, adding the cause tag.

Webgrind Webgrind is an Xdebug profiling web frontend in PHP5. It implements a subset of the features of kcachegrind and installs in seconds and works on all platforms. For quick'n'dirty optimizations it does the job.

⇠ Next Article Previous Article ⇢

About The Author

G. Brad Hopkins's avatar
  • G. Brad Hopkins
  • About Me: I bought my first computer - an Apple Performa 6320 - when I was in college and have been building websites ever since. These days I spend most of my time writing code and helping to bring interesting projects to life.
  • @gbradhopkins