Problem/Motivation

In #3252386: Use PHP attributes instead of doctrine annotations we added an explicit call to gc_collect_cycles() in AttributeClassDiscovery

Profiling the front page of Umami with a cold cache this gets called 23 times - once for each different plugin type used on the page.

I compared before/after with xhprof with and without the call, and can't see any evidence that it does anything useful for us - total memory usage / peak memory usage is very similar with and without it. PHP will do garbage collection when it thinks it needs to anyway.

Steps to reproduce

Proposed resolution

Remaining tasks

User interface changes

Introduced terminology

API changes

Data model changes

Release notes snippet

CommentFileSizeAuthor
#5 Screenshot from 2026-01-02 18-56-22.png164.35 KBcatch

Issue fork drupal-3564917

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

catch created an issue. See original summary.

catch’s picture

Status: Active » Needs review

smustgrave’s picture

Status: Needs review » Reviewed & tested by the community

Seems straight forward. Could you post screenshot of the profiling maybe?

catch’s picture

StatusFileSize
new164.35 KB

Here's the before. This is from an umami front page cold cache miss.

As you can see it's called 23 times, and takes over 200ms. It's possible xhprof adds overhead to garbage collection - not sure about that. But I think we can let PHP handle this itself.

alexpott’s picture

Status: Reviewed & tested by the community » Fixed

Committed 1e8ba42 and pushed to 11.x. Thanks!

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.

  • alexpott committed 1e8ba42f on 11.x
    perf: #3564917 Get rid of gc_collect_cycles() call in attributes...

Status: Fixed » Closed (fixed)

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