Trying to optimize some code
Hi all, I have an include for a dynamic side menu and there is a lot of data in the menus. There is 3 level of menus and hte guy who programmed it made loops inside of loops with different queries. I'm looking for a way to optimize this since it's taking 1000 ms to load. I looked at the cache options but it's not really an option since the color of the menu change from a variable in the url. The code looks somthing like this : query menu loop over menu query submenu for this menu if there is submenu loop over sub menu query subsubmenu for this submenu if there is subsubmenu loop over subsubmenu Any ideas? Thanks Pat ~| Find out how CFTicket can increase your company's customer support efficiency by 100% http://www.houseoffusion.com/banners/view.cfm?bannerid=49 Message: http://www.houseoffusion.com/lists.cfm/link=i:4:196353 Archives: http://www.houseoffusion.com/cf_lists/threads.cfm/4 Subscription: http://www.houseoffusion.com/lists.cfm/link=s:4 Unsubscribe: http://www.houseoffusion.com/cf_lists/unsubscribe.cfm?user=89.70.4 Donations Support: http://www.houseoffusion.com/tiny.cfm/54
Re: Trying to optimize some code
I'd try and cache the menu, and use to URL var to specify a different stylesheet for the colors. -Adam On Thu, 24 Feb 2005 12:45:54 -0500, CFDEV [EMAIL PROTECTED] wrote: Hi all, I have an include for a dynamic side menu and there is a lot of data in the menus. There is 3 level of menus and hte guy who programmed it made loops inside of loops with different queries. I'm looking for a way to optimize this since it's taking 1000 ms to load. I looked at the cache options but it's not really an option since the color of the menu change from a variable in the url. The code looks somthing like this : query menu loop over menu query submenu for this menu if there is submenu loop over sub menu query subsubmenu for this submenu if there is subsubmenu loop over subsubmenu Any ideas? Thanks Pat ~| Find out how CFTicket can increase your company's customer support efficiency by 100% http://www.houseoffusion.com/banners/view.cfm?bannerid=49 Message: http://www.houseoffusion.com/lists.cfm/link=i:4:196354 Archives: http://www.houseoffusion.com/cf_lists/threads.cfm/4 Subscription: http://www.houseoffusion.com/lists.cfm/link=s:4 Unsubscribe: http://www.houseoffusion.com/cf_lists/unsubscribe.cfm?user=11502.10531.4 Donations Support: http://www.houseoffusion.com/tiny.cfm/54
Re: Trying to optimize some code
CFDEV wrote: I have an include for a dynamic side menu and there is a lot of data in the menus. There is 3 level of menus and hte guy who programmed it made loops inside of loops with different queries. I'm looking for a way to optimize this since it's taking 1000 ms to load. I looked at the cache options but it's not really an option since the color of the menu change from a variable in the url. The color is something you could put in a stylesheet. Then the query and the HTML for the menu is the same all the time, you just include a few lines of different CSS with each page. query menu loop over menu query submenu for this menu if there is submenu loop over sub menu query subsubmenu for this submenu if there is subsubmenu loop over subsubmenu This looks like something you could do in one query using outer joins. Jochem ~| Find out how CFTicket can increase your company's customer support efficiency by 100% http://www.houseoffusion.com/banners/view.cfm?bannerid=49 Message: http://www.houseoffusion.com/lists.cfm/link=i:4:196358 Archives: http://www.houseoffusion.com/cf_lists/threads.cfm/4 Subscription: http://www.houseoffusion.com/lists.cfm/link=s:4 Unsubscribe: http://www.houseoffusion.com/cf_lists/unsubscribe.cfm?user=11502.10531.4 Donations Support: http://www.houseoffusion.com/tiny.cfm/54
RE: Trying to optimize some code
Well the color is to highlight the menu for which page we are in at the moment and this is determined by a url variable... Pat -Original Message- From: Jochem van Dieten [mailto:[EMAIL PROTECTED] Sent: February 24, 2005 13:07 To: CF-Talk Subject: Re: Trying to optimize some code CFDEV wrote: I have an include for a dynamic side menu and there is a lot of data in the menus. There is 3 level of menus and hte guy who programmed it made loops inside of loops with different queries. I'm looking for a way to optimize this since it's taking 1000 ms to load. I looked at the cache options but it's not really an option since the color of the menu change from a variable in the url. The color is something you could put in a stylesheet. Then the query and the HTML for the menu is the same all the time, you just include a few lines of different CSS with each page. query menu loop over menu query submenu for this menu if there is submenu loop over sub menu query subsubmenu for this submenu if there is subsubmenu loop over subsubmenu This looks like something you could do in one query using outer joins. Jochem ~| Logware (www.logware.us): a new and convenient web-based time tracking application. Start tracking and documenting hours spent on a project or with a client with Logware today. Try it for free with a 15 day trial account. http://www.houseoffusion.com/banners/view.cfm?bannerid=67 Message: http://www.houseoffusion.com/lists.cfm/link=i:4:196359 Archives: http://www.houseoffusion.com/cf_lists/threads.cfm/4 Subscription: http://www.houseoffusion.com/lists.cfm/link=s:4 Unsubscribe: http://www.houseoffusion.com/cf_lists/unsubscribe.cfm?user=89.70.4 Donations Support: http://www.houseoffusion.com/tiny.cfm/54
Re: Trying to optimize some code
Any ideas? I use only one query, one loop on the query with grouping, and a recursive Custom Tag. Pretty fast indeed, but not really trivial. -- ___ REUSE CODE! Use custom tags; See http://www.contentbox.com/claude/customtags/tagstore.cfm (Please send any spam to this address: [EMAIL PROTECTED]) Thanks. ~| Logware (www.logware.us): a new and convenient web-based time tracking application. Start tracking and documenting hours spent on a project or with a client with Logware today. Try it for free with a 15 day trial account. http://www.houseoffusion.com/banners/view.cfm?bannerid=67 Message: http://www.houseoffusion.com/lists.cfm/link=i:4:196360 Archives: http://www.houseoffusion.com/cf_lists/threads.cfm/4 Subscription: http://www.houseoffusion.com/lists.cfm/link=s:4 Unsubscribe: http://www.houseoffusion.com/cf_lists/unsubscribe.cfm?user=89.70.4 Donations Support: http://www.houseoffusion.com/tiny.cfm/54
Re: Trying to optimize some code
CFDEV wrote: Well the color is to highlight the menu for which page we are in at the moment and this is determined by a url variable... That is no problem. Consider the folowing menu: cfoutput style type=text/css ul.menu li.#url.page# {background-color: navy;} /style /cfoutput ul id=menu li id=homea href=/Home/li li id=productsa href=/Products/li li id=servicesa href=/Services/li li id=contacta href=/Contact/li /ul The menu is still the same, all you change is which item is highlighted. Jochem ~| Discover CFTicket - The leading ColdFusion Help Desk and Trouble Ticket application http://www.houseoffusion.com/banners/view.cfm?bannerid=48 Message: http://www.houseoffusion.com/lists.cfm/link=i:4:196363 Archives: http://www.houseoffusion.com/cf_lists/threads.cfm/4 Subscription: http://www.houseoffusion.com/lists.cfm/link=s:4 Unsubscribe: http://www.houseoffusion.com/cf_lists/unsubscribe.cfm?user=89.70.4 Donations Support: http://www.houseoffusion.com/tiny.cfm/54