Problem/Motivation

While debugging performance problems of one of my projects, I came across a bottleneck in Drupal\api_toolkit\Normalizer\CachedNormalizer, causing heavy slowdowns. For every entity that's being normalized, isLatestRevision() is called, causing an extra database call. This change was introduced in #3521150: Specific revisions aren't cached separately.

Proposed resolution

By removing this call, I was able to speed up a request with a lot of normalizations from 24.6s to 1.03s. I think it's safe to always add the revision ID to the cache key instead of only when it's not the last revision.

Command icon Show commands

Start within a Git clone of the project using the version control instructions.

Or, if you do not have SSH keys set up on git.drupalcode.org:

Comments

dieterholvoet created an issue. See original summary.

dieterholvoet’s picture

Status: Active » Needs review

  • dieterholvoet committed 18fb0308 on 1.x
    Issue #3562404 by dieterholvoet: isLatestRevision() call heavily slows...
dieterholvoet’s picture

Status: Needs review » Fixed

Now that this issue is closed, review the contribution record.

As a contributor, attribute any organization that helped you, or if you volunteered your own time.

Maintainers, credit people who helped resolve this issue.

Status: Fixed » Closed (fixed)

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