custom_breadcrumbs_load_breadcrumbs() and custom_breadcrumbs_set_menu_breadcrumb() functions generate huge amount of identical databse queries.
Devel module shows me next queries when I load my site taxonomy/term/5 page:
duration count function query
--------------------------------------------------------------------------------------
.......
0.09 9 custom_breadcrumbs_set_menu_breadcrumb SELECT mlid FROM menu_links WHERE link_path = 'taxonomy/term/5'0.1278custom_breadcrumbs_load_breadcrumbsSELECT * FROM realty_custom_breadcrumbs_paths WHERE specific_path = 'taxonomy/term/5' AND language IN ('ru','') ORDER BY language ASC
0.14 78 custom_breadcrumbs_load_breadcrumbs SELECT * FROM custom_breadcrumbs_paths WHERE specific_path = 'taxonomy/term/5' AND language IN ('ru','') ORDER BY language ASC
0.13 78 custom_breadcrumbs_load_breadcrumbs SELECT * FROM custom_breadcrumbs_paths WHERE specific_path = 'taxonomy/term/5' AND language IN ('ru','') ORDER BY language ASC
0.21 9 custom_breadcrumbs_set_menu_breadcrumb SELECT mlid FROM menu_links WHERE link_path = 'taxonomy/term/5'
0.11 78 custom_breadcrumbs_load_breadcrumbs SELECT * FROM custom_breadcrumbs_paths WHERE specific_path = 'taxonomy/term/5' AND language IN ('ru','') ORDER BY language ASC
0.09 9 custom_breadcrumbs_set_menu_breadcrumb SELECT mlid FROM menu_links WHERE link_path = 'taxonomy/term/5'
0.11 78 custom_breadcrumbs_load_breadcrumbs SELECT * FROM custom_breadcrumbs_paths WHERE specific_path = 'taxonomy/term/5' AND language IN ('ru','') ORDER BY language ASC
.......
This is only small excerpt from log. There are much more identical queries generated by custom_breadcrumbs_load_breadcrumbs() and custom_breadcrumbs_set_menu_breadcrumb() functions to load the page.
I believe it is very expensive to make hundreds database queries in order to show just breadcrumbs.
Suggested patch makes use of static variables to cache identical queries in mentioned functions.
Comment | File | Size | Author |
---|---|---|---|
#1 | custom_breadcrumbs-cache.patch | 2.83 KB | v.sidorov |
Comments
Comment #1
v.sidorov CreditAttribution: v.sidorov commentedHere is the patch.
Comment #2
MGN CreditAttribution: MGN commentedThanks. This is an excellent idea. I'll test it out and get it into 6.x-2.x-dev and the upcoming beta4 release.
Comment #3
MGN CreditAttribution: MGN commentedCommitted to 6.x-2.x-dev. http://drupal.org/cvs?commit=372384