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.
Issue fork api_toolkit-3562404
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
Comment #3
dieterholvoet commentedComment #5
dieterholvoet commented