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:
  1. function __autoload($class) {
  2.     require str_replace('_', '/', $class) . '.php';
  3. }

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

Hope you find this useful.
Cheers

Related Posts

  • Interesting. Zend_Loader is perhaps a somewhat complex class for just autoloads... What kind of speed difference did you see?
  • 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!
  • 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 ;)
  • 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
blog comments powered by Disqus