Optimizing Zend performance – small tip


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

Source: gsdesign.ro

Advertisements

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s