Topic: Nasty drop-down menu performance

We have a site where the client has insisted on a complex, multi-level drop-down menu.  Each page is doing a lot of queries and a lot of work is done in the application helper to build the menu.  Each page request hits the pages, categories (both of which use acts_as_tree) and products models heavily, despite this data not being changed very often.

I noticed that if we take out the menu rendering we have a more manageable situation which could be improved much easier with normal caching measures. Sooo, I thought it might be an idea to use after_save hooks in the pages, categories and products models to trigger some code which renders the menu to a file and just include this flat file.

Firstly, is this a good idea? and if so how do I re-factor this to take everything out of the application_helper and to somewhere where those models can see it and it can render the menu into a file?


Thanks,

Matt.