Statically cache node access grants

Created on 18 February 2014, almost 11 years ago
Updated 25 January 2024, 11 months ago

node_access_grants() is called once per node during a request when node_access is implemented. For most implementations, this is a very cheap request. When implementations of hook_node_access_grants_alter() are expensive, however, the performance of the page suffers massively.

The primary assumption that I am making here is that node_access_grants() will never change within a single request for any given combination of $account and $op. That is what I would like confirmation on from others.

Locally, I am seeing node_access_grants() reduced from ~1.2s to ~60ms. This particular site has some custom checks that are expensive, but the $grants array is the same each time, so it appears there's no reason to call this multiple times.

πŸ› Bug report
Status

Needs work

Version

11.0 πŸ”₯

Component
Node systemΒ  β†’

Last updated about 23 hours ago

No maintainer
Created by

πŸ‡ΊπŸ‡ΈUnited States erikwebb

Live updates comments and jobs are added and updated live.
  • Performance

    It affects performance. It is often combined with the Needs profiling tag.

  • Needs issue summary update

    Issue summaries save everyone time if they are kept up-to-date. See Update issue summary task instructions.

Sign in to follow issues

Merge Requests

Comments & Activities

Not all content is available!

It's likely this issue predates Contrib.social: some issue and comment data are missing.

Production build 0.71.5 2024