Nick Dunn made some huge improvements on Symphony Core. Reducing query count does matter but I think Symphony needs a better optimization over memory usage. Some Data Sources consumes about 1MB or so! Why?

  • How can I benchmark Symphony?

As Symphony is object-oriented It consumes more memory. I’ve saw some guides about PHP Benchmarking practices and maybe these practices could be applied on Symphony.

What do you know about benchmarking? How can we make Symphony better? ;-)

After nailing the queries I did turn attention to memory usage. 2.0.7 (beta) and the latest (github) Profiler devkit gives good feedback as to the memory used in each DS etc. I wrote a simple class that dumps out memory usage throughout the page lifecycle so I could see where bottlenecks were.

There are two reasons for DSs consuming a lot of memory:

  • the first DS that runs will always consume the most. It is the require_once of various classes that uses a lot. The first DS will include these, and subsequent ones won’t need to
  • the building of XML using the XMLElement class uses more memory than it needs to. Many have tried, and failed, to replace it with DomDocument. It’s not a simple one-to-one replacement, and Alistair conceded defeat: moving to DomDocument would mean the entire core and all extensions would need to be rewritten. Something for Symphony 3 then! ;-)

I added this to my index.php

Class MemoryUsage {
    static $base = null;
    static $log = array();
    public static function log($desc) {
        $usage = memory_get_usage();
        if  (self::$base == null) {
            self::$base = $usage;
        self::$log[] = $desc . ': ' . General::formatFilesize($usage - self::$base);
    public static function dump() {

Throughout the core I would add this:

MemoryUsage::log('Page start');
MemoryUsage::log('Include SectionManager');
MemoryUsage::log('Build entries');

And so on. Then in index.php, before echo $output I’d add:


This should let you print out the memory used at various places throughout the frontend.

Thanks, I’ll try it!

Create an account or sign in to comment.

Symphony • Open Source XSLT CMS

Server Requirements

  • PHP 5.3-5.6 or 7.0-7.3
  • PHP's LibXML module, with the XSLT extension enabled (--with-xsl)
  • MySQL 5.5 or above
  • An Apache or Litespeed webserver
  • Apache's mod_rewrite module or equivalent

Compatible Hosts

Sign in

Login details