drupal_get_breadcrumb() can be expensive (can invokes various menu perm callbacks). We should avoid calling it unless necessary.

See patch.

menu_breadcrumb_perf.diff1.28 KBdalin
Membership dollars fund testing for the Drupal project. Drupal Association Learn more


m4olivei’s picture

Is that really a performance improvement? If you look at the code in drupal_get_breadcrumb() it calls drupal_set_breadcrumb() to get the data and that function does the heavy lifting once, storing the result in a static variable which is returned on subsequent calls.

So no matter how many times you call drupal_get_breadcrumb() the performance hit after the first time is next to nill.