Modular Themes: Performance

April 2010

A note, before we get started:
This is an aside from a series about Modular Themes.
You should probably take a look at part 1.

I’m sure some of you are wondering about the performance of get_template_module() and how it affects load speeds. From my tests, it doesn’t: Based on average template load time over 100 loads, Modularized Twenty Ten was seven hundred-thousandths of a second faster than vanilla Twenty Ten. For those of you who don’t like math, that means they were the same.

Average template load speeds over 100 trials:
Modularized Twenty Ten is faster by 0.0000741 seconds.
Twenty Ten: 0.0410812 seconds.
Modularized Twenty Ten: 0.0410071 seconds.

In addition, I tested get_module_template() on a nonexistent module 100000 times using various template hierarchies:

An average template hierarchy: (i.e. home, a post, a page)
Total time to run get_template_module('fake') 100000 times:
6.023 seconds

Average time to run get_template_module('fake') once:
.00006023 seconds

A complex template hierarchy: (i.e. a category)
Total time to run get_template_module('fake') 100000 times:
8.0706 seconds

Average time to run get_template_module('fake') once:
.000080706 seconds

If anyone would like (me) to conduct a more thorough test, please let me know.

Modular Themes:
Trac Ticket | Part 1: Why? | Part 2: Theme Organization | Download | Performance