On a very big website with a lot of content types, taxonomy and contexts, this function takes ~150ms so about 25% of the website total rendering time.

I quickly patched it with a simple cache_get/set:

--- i/path_breadcrumbs.module
+++ w/path_breadcrumbs.module
@@ -17,7 +17,14 @@ define('PATH_BREADCRUMBS_RICH_SNIPPETS_MICRODATA', 2);
  */
 function path_breadcrumbs_page_alter() {
   // See if current page has path breadcrumbs.
-  $breadcrumbs = path_breadcrumbs_load_variant(current_path());
+  $cache = cache_get('path_breadcrumbs:' . current_path(), 'cache');
+  if ($cache) {
+    $breadcrumbs = $cache->data;
+  }
+  else {
+    $breadcrumbs = path_breadcrumbs_load_variant(current_path());
+    cache_set('path_breadcrumbs:' . current_path(), $breadcrumbs, 'cache');
+  }
 
   // Set breadcrumbs for current page if it exists.
   if ($breadcrumbs) {

Comments

spleshka’s picture

Status: Active » Needs work

Don't forget that you have to flush cache when breadcrumb was updated.

caschbre’s picture

@bastnic... how was performance after this patch?

@Splenshka... are there plans to commit this?

spleshka’s picture

@caschbre, patch is not complete. I have to dig dipper before commit this.

bastnic’s picture

@caschbre very good of course. But as I said, I bypass a lot of things with this dummy patch. It was just to prove that this function have a big performance cost. But the website in question was already very big and fast so the 25% is not the average cost I think, but it's still too big.

caschbre’s picture

Good stuff!

I'm porting a large D6 site to D7 and want to switch from using custom_breadcrumbs to path_breadcrumbs. Performance is pretty important given the large quantity of content / users.

spleshka’s picture

Version: 7.x-2.0-beta16 » 7.x-3.x-dev
Status: Needs work » Fixed

Performance was imporoved in 7.x-3.x (see commit 6a77580)

spleshka’s picture

Status: Fixed » Closed (fixed)

Closing this issue. Please, feel free to reopen it if you have any questions.