Skip to content

Contextual links - performance issue #1409

Open
@Gormartsen

Description

@Gormartsen

I just noticed that this module slow down Backdrop.

Some debug info: (it's a function call tree)

[2.5%]  |    |    |    |    |    |    └── theme [0.06 Mb] [realtime: 2.993 ms] 
[2.4%]  |    |    |    |    |    |    |    └── template_preprocess_block [0.06 Mb] [realtime: 2.828 ms] 
[2.1%]  |    |    |    |    |    |    |    |    └── contextual_pre_render_links [0.06 Mb] [realtime: 2.427 ms] 
[2.0%]  |    |    |    |    |    |    |    |    |    └── menu_contextual_links [0.06 Mb] [realtime: 2.350 ms] 
[1.5%]  |    |    |    |    |    |    |    |    |    |    └── menu_get_item [0.05 Mb] [realtime: 1.763 ms] 
[1.0%]  |    |    |    |    |    |    |    |    |    |    |    └── db_query_range [0.02 Mb] [realtime: 1.179 ms] 

The real problem is here:

https://github.com/backdrop/backdrop/blob/a5070a3ac1d5efb99bcae631b2b0b7484320f33e/core/includes/menu.inc#L2177

function menu_contextual_links($module, $parent_path, $args) {
......
  $router_item = menu_get_item($path);
  if (!$router_item || !$router_item['access']) {
    $path_empty[$parent_path] = TRUE;
    return $links;
  }

When I disable this module, page execution time decrease for ~10% for 6 blocks (like menu, breadcrumbs, footer and etc... you know, default one)

When I tested with 11 blocks, page execution time difference was 20%

  • 150ms (contextual links enables)
  • 118ms (disabled).

I don't have a solution for this issue so far.

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions