For performance reasons it can help to skip hook_context_page_condition(), but obviously it should be processed by default.

Comments

damienmckenna’s picture

Status: Active » Needs review
StatusFileSize
new1.06 KB

Here's an initial patch that just adds a variable 'context_skip_hook_page_condition' which controls whether context_context_page_condition() is executed.

damienmckenna’s picture

FYI one use case where this is useful is for sites that don't use the core menu system to control their navigation, so spending time to process menu_get_active_trail() is redundant.

damienmckenna’s picture

StatusFileSize
new1.06 KB

Updated patch.

yhahn’s picture

Status: Needs review » Postponed (maintainer needs more info)

I'd like to know a little more about where you're seeing a performance hit here... menu_get_active_trail() retrieves a static cache and is called by menu_get_active_breadcrumb() and sometimes drupal_get_title(). These are both called from template_preprocess_page() so unless a theme is flying solo in the preprocess page stack these functions will get called.

damienmckenna’s picture

I've requested the developer who created this patch (datacaliber) to provide more information, hopefully he will.

dstol’s picture

This would seem to be related to #811424: Only execute conditions/reactions that are used by contexts unless I am mistaken.

steven jones’s picture

Status: Postponed (maintainer needs more info) » Closed (duplicate)