Spiga

Optimizing Zend performance – small tip

by Gabi Solomon

If you started working with Zend Framework you have notice that it is a bit slower then your regular php application.
This is due more or less to the double sword of having such a big framework to work with.

There are a lot of tips and tutorial out there on how to optimize your Zend Framework, and in all of them you will see the recommendation to remove the require_once from the library and to use Zend_Loader. Wich is a good advice since all those require_onces do put some stress on your application.

But after a bit of testing i camed to the conclusion that Zend_Loader isn’t so fast. So i decided to go revert to a simple solution: writing my own autoloader.
I just put this small function at the top of my zend bootstrap file.
[php]
function __autoload($class) {
require str_replace(‘_’, ‘/’, $class) . ‘.php’;
}
[/php]

And because i wrote all my application using Zend / Pear naming standard it works pretty good.

Hope you find this useful.
Cheers

  • http://codeutopia.net/ Jani Hartikainen

    Interesting. Zend_Loader is perhaps a somewhat complex class for just autoloads… What kind of speed difference did you see?

  • http://www.gsdesign.ro/ Gabi Solomon

    i only did a simple profiling with xdebug and saw a 30ms decrease in time spent loading with ZendLoader and now with autoload.
    This considering that i actually have extended ZendLoader and remove some of its features that seem a little overkill like the security check.

    • Sebastian M

      how much took it before the change? The information “30ms” is nothing worth if you don't give us any reference value. Thanks!

  • http://richardknop.com Richard Knop

    Well this is indeed interesting. I have started using Zend just recently and I have noticed it is way slower than my custom MVC framework (but I think a tradeoff in flexibility and power Zend gives you is pretty good).

    I will give this a try ;)

  • http://www.virtue-software.com/ Riki Risnandar

    Thank you for the tip to optimize zend framework

  • 123maizo

    software, movie, music,ebook,game rapidshare megaupload mediafire hotfile download all at http://soft.123maizo.com tivionline at http://tivi.123maizo.com

  • http://www.air-jordan-14.com air jordan 14

    Mark S. is definitely on the right track. If you want to get a professional looking email address, Id recommend buying your name domain name, like or
    air jordan 3.5
    If its common it might be difficult to get, however, be creative and you can usually find something.

  • http://www.modularhomesnetwork.com/ModularHomes/modular-home-manufacturers.asp Manufactured Homes

    I remember having the same experience.

  • http://www.findprefab.com/find-prefab-homes/panelized-sip Panelized Homes Houses

    This is my first time I have visited this site.

  • http://www.modularhomesnetwork.com Manufactured Homes

    I actually liked reading your writing! I might boost you to submit blogs a bit more frequently.

  • http://www.modularhomesnetwork.com/ Modular Homes

    totally AMAZING!!! Thanks for the detailed instructions.

  • http://www.modularhomesnetwork.com/ Modular Homes

    Great read! I wish you could follow up on this topic.

  • Pingback: Optimizing Zend performance – small tip « DBGLORY 4 YOU