8000 [DependencyInjection][EventDispatcher] Avoid instantiating not called listeners when tracing by Jean-Beru · Pull Request #45184 · symfony/symfony · GitHub
[go: up one dir, main page]

Skip to content

[DependencyInjection][EventDispatcher] Avoid instantiating not called listeners when tracing #45184

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Conversation

Jean-Beru
Copy link
Contributor
Q A
Branch? 6.1
Bug fix? no
New feature? no
Deprecations? no
Tickets Fix #43658
License MIT
Doc PR

This PR removes useless listeners instantiation when TraceableEventDispatcher::getNotCalledListeners() is called.

Even if this PR is in WIP, I created it to allow comments from @nicolas-grekas (and anyone interested in of course).

@carsonbot carsonbot added this to the 6.1 milestone Jan 26, 2022
@carsonbot carsonbot changed the title [DI][EventDispatcher] Avoid not called listeners instantiation [DependencyInjection][EventDispatcher] Avoid not called listeners instantiation Jan 26, 2022
Copy link
Member
@nicolas-grekas nicolas-grekas left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

we might need to update the YamlFileDumper an the XmlFileDumper also (and the loaders+configurator)

@Jean-Beru
8000 Copy link
Contributor Author

I also updated XML and Yaml loader.

Copy link
Member
@nicolas-grekas nicolas-grekas left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looking nice :)
Please add a test case in EventDispatcher also.

@Jean-Beru
Copy link
Contributor Author

I added some tests but Psalm still warns about ClassStub. Its constructor called with a string as second argument.

Updating Psalm annotation makes the CI throw a Attempt to modify property "parent_nodes" on null error. Any idea ?

@nicolas-grekas nicolas-grekas changed the title [DependencyInjection][EventDispatcher] Avoid not called listeners instantiation [DependencyInjection][EventDispatcher] Avoid instantiating not called listeners when tracing Feb 5, 2022
@nicolas-grekas nicolas-grekas force-pushed the feat/43658_improve_TraceableEventDispatcher branch from 32b9fbd to bdb8d6a Compare February 5, 2022 11:50
Copy link
Member
@nicolas-grekas nicolas-grekas left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

(I pushed some changes, see 2nd commit)

@Jean-Beru
Copy link
Contributor Author

OK great ! Thanks.

@nicolas-grekas nicolas-grekas force-pushed the feat/43658_improve_TraceableEventDispatcher branch from aca93ff to d4e60e9 Compare February 18, 2022 13:03
@nicolas-grekas
Copy link
Member

Thank you @Jean-Beru.

@nicolas-grekas nicolas-grekas merged commit 2d723e1 into symfony:6.1 Feb 18, 2022
@Jean-Beru Jean-Beru deleted the feat/43658_improve_TraceableEventDispatcher branch April 25, 2022 08:46
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

[EventDispatcher] Performance of TraceableEventDispatcher::getNotCalledListeners()
3 participants
0