Attention: I know that there are bugs, with my fix based on the configuration of your menu system. Since I can not replicate these issues myself, I can not fix them on my own. I would like to complete the fix for those people who may want to use joomla with dynamic caching. If you are interested please email me at joomlafixd@yahoo.com.
It’s no secret that there are serious performance problems with Joomla 1.5x. Especially if you’re not using caching. Right out of the box, most sites see memory and CPU usage go through the roof with each request. This problem is well documented, and even Joomla’s own website has pages dedicated to helping users come up with fixes and work-arounds.
After much frustration on a recent project, I decided to investigate the problem. Below is what I discovered.
First: By turning off the Main Menu in the Module Manager, there is vast improvement in performance to be found. This is where most of the resources are greedily consumed.
Next: To recreate the functionality of the menu system, I created a hack that caches the HTML for all of Joomla’s menus. I’ve made this available to the public, below.
Note: The project I worked on has a fairly large menu, about five levels deep. But this hack should work for any size menu.
Here are the results.
Before
Profile Information
Application afterLoad: 0.002 seconds, 0.43 MB
Application afterInitialise: 0.214 seconds, 2.28 MB
Application afterRoute: 0.341 seconds, 3.78 MB
Application afterDispatch: 0.482 seconds, 4.33 MB
Application afterRender: 5.377 seconds, 6.02 MB
Memory Usage
6346872
45 queries logged
After
Profile Information
Application afterLoad: 0.002 seconds, 0.43 MB
Application afterInitialise: 0.191 seconds, 2.28 MB
Application afterRoute: 0.308 seconds, 3.78 MB
Application afterDispatch: 0.446 seconds, 4.33 MB
Application afterRender: 0.708 seconds, 5.16 MB
Memory Usage
5455480
45 queries logged
Notice the afterRender where the Top Menu module executes. Significant time and memory has been shaved off.
While the performance improvements are most noticeable when you’re not using caching (either free or purchased), this hack will work alongside all the caching plug-ins available.
Also, I have not come up with an elegant way to make a plug-in, so you’ll have to replace some files to get it to start working. (If you have suggestions on how best to make this a plug-in, let me know.)
Instructions
1. Make a back-up copy of these files in case it does not work properly for your install. Then copy helper.php under your docs/modules/mod_mainmenu
item.php and list.php under /docs/administrator/components/com_menus/models.
2. Replace those files with these, under the same directory: helper.php, item.php, and list.php.
3. Make sure that the docs/cache folder is write-able, you should start seeing .html files appear with in your cache directory. The html files are all the menu files cached so that Joomla does not have to execute or build the data structure to write them out. The source files that go in the administrator component will take care of menu changes by deleting the specific cache.
Update on joomlacode:
There are two patches mines and this one. My patch should be a greater performance boost, but as I said this is more a work around or hack. I do not know if joomla is addressing this in any other fashion.
Also if you are experiencing bugs, please email me at joomlafixd@yahoo.com, so maybe I can work out a universal solution in case joomla does not come up with an actual fix.
Posted by joomlaspeed