Let me preface this by saying there might be nothing we can do here due to core.

Every request to /admin/config causes hook_requirements('runtime') to be invoked. Metatag then calls system_rebuild_module_data() which adds significant time to the request because it only uses static caching and forces a scan of the site modules.

I'm wondering if we can rework this requirements check or use caching to prevent this from firing on ever request. Perhaps using module_list or system_get_info instead or use caching to help. I wanted to get feedback before jumping into writing a patch :)

I'm including a Blackfire.io timeline to show what I'm talking about.

Comments

andyg5000 created an issue. See original summary.

andyg5000’s picture

Component: Documentation » Code
andyg5000’s picture

If system_get_info('module') is sufficient, I'm getting almost 500% savings calling that instead. However Damien may have good reason for complete re-scan!

andyg5000’s picture

StatusFileSize
new29.08 KB
damienmckenna’s picture

Status: Active » Needs review
Issue tags: +Performance
StatusFileSize
new495 bytes

Excellent point, thanks for digging into this.

Here's a patch with the change you suggested.

andyg5000’s picture

Status: Needs review » Needs work

Sorry, I didn't mean to insinuate that those methods were interchangeable :) The return different things, so we'd need to update the logic that follows as well. For example, we're checking schema version on one of them and that isn't returned by system_get_info().

damienmckenna’s picture

Duh (-:

Some of the version checking could be replaced with checking to see if there's a specific update script in the module's install file.

lolandese’s picture

For the GIT Info Report module (D8) I encountered the same issue. As I was fine with the code running only on the Status report, it was solved easily just adding a conditional to see if the current route is system.status.

See #3093404: Code seems to run on 'admin/config' as well.

damienmckenna’s picture

Apologies, this was duplicated in #3109898: metatag_requirements() loads slowly due to system_rebuild_module_data() which was committed recently.

  • DamienMcKenna committed f8d0f45 on 7.x-1.x
    Issue #3109898/#2954968 by malcolm_p, andyg5000, DamienMcKenna:...

Status: Fixed » Closed (fixed)

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