Whilst setting up a performance testing environment I noticed that we can improve the implementation in node_block_access() to not do unnecessary calls to menu_get_object(); and node_type_get_types();.

Comments

alexpott’s picture

Issue tags: +needs profiling
StatusFileSize
new2.16 KB

Here's the patch

alexpott’s picture

Status: Active » Needs review
alexpott’s picture

StatusFileSize
new2.23 KB
new560 bytes
new140.46 KB
new177.08 KB

Here's an xhprof of the function calls to node_block_access on the front page of a Drupal standard install with 2 nodes promoted...

Without the patch

without-patch-2.png

With the patch

with-patch.png

catch’s picture

Status: Needs review » Reviewed & tested by the community

Looks great.

alexpott’s picture

Assigned: Unassigned » dries

Well... I wrote the patch and catch rtbc'd so this is Dries's :D

dries’s picture

Status: Reviewed & tested by the community » Fixed

Committed to 8.x. Thanks.

dries’s picture

Assigned: dries » Unassigned

Automatically closed -- issue fixed for 2 weeks with no activity.