Page 1 of 6

[BETA] Speedy Templates 0.1.6

Posted: Wed Mar 05, 2008 12:42 am
by ckwalsh
MOD Title: Speedy Templates
MOD Description: A caching enabled template engine to replace the standard phpBB engine. The main goal of speedy is to be as fast as possible while maintaining compatibility.
MOD Version: 0.1.6

I was talking to some other phpBB users about optimizing phpBB and it was pointed out that most of the page execution time is spent with template.php, not queries. I slightly modified the stock template.php to add caching to see how it would compare. It was faster than the standard template.php, but nowhere close to XS or another template engine posted by someones else. Being competitive, I decided to work on a more efficient engine (modified from the stock engine) and this is the fruits of my labors.

MOD Download: Download

  • Fastest compile and execution times of any template engine available
  • Removes requirement for templates loops to be on their own line
  • Caches compiled templates
  • Option to cache language variable in compiled templates
  • Degrades gracefully if unable to cache templates
  • Able to run php code from templates
  • Easy Installation
The goal of this engine is to be as fast as possible while retaining the functionality of the standard phpBB template. When being designed, php inclusion in templates happened to be a nice byproduct, not a planned feature. If you are looking for added functionality for your templates, such as includes, additional variable availability, or improved ACP style management, I suggest you look at the eXtreme Styles MOD.


  • Initial release
  • Rewritten code for readability
  • Fixed problem with eval and JumpBox
  • Fixed problem with wrong values replacing placeholders
  • Added code to generate different filename based on version
  • Added regex to combine back-to-back php tags
  • Removed static declaration for php4 compatibility
  • Renamed files variable back to standard name for attachment MOD support
  • Figured out the real problem with the attachment MOD and fixed it. (Requires modification to attach_mod/displaying.php)
  • Suppresses errors properly when cache is not writable
  • Removed duplicate code from assign_var_from_handle
  • Added Language cache feature. Can be toggled on/off by commenting line.
  • Added automatic checking or language updates. Can be toggled on/off by commenting line.
  • Output buffered pparses to speed up load times
  • Much prettier cache filenames
  • Whitespace is stripped from compiled templates
  • Created blacklist of template variables prefixed with 'L_' to never cache with the language cache. These are strings that may change from page to page.
  • Split up template.php into 2 files, one containing only the compile function to improve overall parse time.
Specific MOD workarounds
Attachment MOD
Split Topic Type Mod

Re: [BETA] Speedy Templates 0.1.0

Posted: Wed Mar 05, 2008 4:02 am
by mdvaldosta
I could see this being very useful, and it's nice to see some folks are still modding v2.

Re: [BETA] Speedy Templates 0.1.0

Posted: Thu Mar 06, 2008 5:01 am
by Peter77sx
To have alternatives is good. what about those with simple subforums MOD which requieres eXtreme styles MOD to run... :?:

Re: [BETA] Speedy Templates 0.1.0

Posted: Thu Mar 06, 2008 5:27 am
by ckwalsh
I have not checked what exactly simple subforums depends on in XS in order to work. I'll try it and update the first post accordingly. If it does work, great. If it doesn't however, I am not sure if this mod will be altered to work. It will depend on whether I can get compatibility without sacrificing speed.

Re: [BETA] Speedy Templates 0.1.0

Posted: Thu Mar 06, 2008 3:47 pm
by drathbun
I have been testing this code extensively (performance testing, not functionality testing) and I can say that the claims of being faster are quite accurate. :) I have been working with Brainy's code in various iterations for over a week now and I am very pleased with the results so far.

I have been blogging about the testing (see signature for link) and expect that I will be reporting the final load test results within a few weeks or so. I am testing Brainy's code against a stock (unmodified) phpBB2 template engine, the current version of eXtreme Styles, and a modified version of the template code from Categories Hierarchy. The testing methods and results will all be in my blog as I get time to write them up.

One of the most important aspects of the testing, in my opinion, is how the template systems hold up under load. I tested one of Brainy's earlier releases (perhaps 0.0.5? :lol:) and it did fairly well but came in third. The eXtreme Styles and Categories Hierarchy code came out on top, within a tiny fraction of each other. Once I put the system under heavier load, the Categories Hierarchy code started pulling away and eXtreme Styles dropped back. So that suggests to me that for very active boards the eXtreme Styles code - while fast - is not the fastest option available. It does, as Brainy pointed out, offer a substantial benefit in the area of increased features however.

I have not yet performed the load testing with this version of the code. The older version slowed down more than eXtreme Styles in the load tests, leaving it in 3rd place and by a wider margin. I am eagerly looking forward to the results after plugging in Brainy's new code. :)

I certainly appreciate the efforts being put forth. As said earlier:
mdvaldosta wrote:I could see this being very useful, and it's nice to see some folks are still modding v2.

Re: [BETA] Speedy Templates 0.1.0

Posted: Thu Mar 06, 2008 11:13 pm
by Dog Cow
I had been wondering about this "mysterious, new engine" since drathbun mentioned it the other day. Now I've found it. :geek:

I'm going to try this out on my site, which currently uses a stripped-down version of XS, later this evening and tell you how it turns out.

Also... about the Doctor Blog: I had known about it but had never actually thoroughly explored it. My mistake. :oops: I am now in the process of downloading all the articles to read at home.
Peter77sx wrote:To have alternatives is good. what about those with simple subforums MOD which requieres eXtreme styles MOD to run... :?:
Simple subforums MOD, in my opinion, shouldn't have been designed the way it was, such that it requires XS mod. Fortunately, it is very easy to change it so it does not require the XS mod, and I have made these changes to my site and can tell anyone else who wants to know.

Re: [BETA] Speedy Templates 0.1.0

Posted: Fri Mar 07, 2008 2:34 am
by drathbun
I just completed a load test with 35 concurrent sessions refreshing pages every 7 seconds on my development server at my house. I am not going to publish numbers until I have a chance to review them, but the preliminary indications are that the Speedy Template engine lives up to its name. I am testing 4 different engines (Speedy, eXtreme Styles, Categories HIerarchy, and phpBB2 standard) and Speedy is consistenly one of the top performers. In some cases by a little, and in other cases by a substantial percentage.

I am trying to not have any bias in how I build the tests and interpret the numbers. When I post the final results I will also make available all of my raw data so that anyone can run their own analysis. I do currently use eXtreme Styles on my boards.

Dog Cow (Moof) thank you for the kind words about my blog. :) I was absent from it for many months but this investigation has spawned a new run of posts.

My results

Posted: Fri Mar 07, 2008 9:51 pm
by Dog Cow
For my main site (Mac GUI City), the template messed up my forums index, and almost all other pages were blank and would not load. :( Trying it on a more "normal" phpBB forum, I got pages to go from 1.3s down to 1.2s (yes, I have old slow machine), so it is definitely faster.

Re: [BETA] Speedy Templates 0.1.0

Posted: Fri Mar 07, 2008 10:34 pm
by ckwalsh
Hmmm... Could you PM me a the compiled templates and the normal templates?

Re: [BETA] Speedy Templates 0.1.0

Posted: Thu Mar 13, 2008 2:56 am
by eduardor2k
Hi, your template works fine when i run it in local, but doen't work on my server.

I think it's because some w/r privilieges...

┬┐could you tell me, what folders need to be chmoed to 777?


Re: [BETA] Speedy Templates 0.1.0

Posted: Thu Mar 13, 2008 3:01 am
by ckwalsh
The cache folder in the phpBB root directory must be chmodded to 777.

My goal is to have it work well even without that, but there are still some bugs.

Re: [BETA] Speedy Templates 0.1.0

Posted: Thu Mar 20, 2008 7:20 pm
by drathbun
Just wondering if there are any updates to the code at this point. Or even a list of known bugs if that's something that can be provided. I'm getting ready to roll out a major update to my phpBB2 board, should I include this? Or is it ready for "prime time" yet? :)

Thanks, look forward to an update.

Re: [BETA] Speedy Templates 0.1.0

Posted: Thu Mar 20, 2008 7:44 pm
by ckwalsh
The only person who has reported a bug had been DogCow, and I have not been able (so far) to figure out what's wrong.

You and him are the only ones that have contacted me saying you have tried it on your boards (or preferably test boards)

I am busy over the weekend, so I probably won't check this thread again until at least Sunday. I'm too busy playing with robots.

Re: [BETA] Speedy Templates 0.1.0

Posted: Thu Mar 20, 2008 8:09 pm
by drathbun
Have fun. :)

I'm going to push your code up to my beta board and let some other folks beat on it next week. I'll let you know if I encounter any issues.

Re: [BETA] Speedy Templates 0.1.0

Posted: Fri Mar 21, 2008 5:38 pm
by drathbun
Ok, have a bug report. Or something, I'm not sure it's actually a bug. I just implemented speedy template on a test site where I have been doing some active development. I noticed some header values for one of my output pages were gone. I restored to the original template engine in use and they came back. So I did some research.

The template variable was {L_FORUM}. It was working fine with eXtreme Styles. What I found was that my php code did NOT specifically set that variable up, so it was being defaulted from somewhere. Speedy Template is missing the default, while eXtreme Styles was finding it.

I first looked in includes/page_header.php as that's where a lot of language strings are set. It wasn't there. I looked in other pages, it wasn't there.

So at the moment I am at a loss. :) It seems that this isn't really a bug, but somehow a feature of eXtreme Styles. There's no problem with going back and resetting language strings in my files, but I now am going to have to go through my board and find out other pages where I might have taken shortcuts and fix them.