Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Compiled EventSubscriber for possible performance optimization #26993

Closed
@grisendo

Description

@grisendo
Q A
Bug report? no
Feature request? yes
BC Break report? no
RFC? yes
Symfony version x

I was doing some debugging with a custom CMS made with Symfony (3.x) using Blackfire, in order to improve the performance as much as possible. I am not a profiler expert, but I saw that a huge amount of time was spent with "EventDispatcher" class, at "sortListeners" method. So, I was thinking: I always add events listeners/subscribers using tags in service container, so why subscribed classes are not already added and sorted in the container when compiling? Why not to create a CompiledEventSubscriber that you can optionally use instead of normal one, if you are pretty sure you only work with container-tag defined event subscriptions?

I don't know if there is already something about this topic, I was discussing it today at Slack, and @ostrolucky show me his own solution: https://github.com/ostrolucky/app-event-dispatcher/blob/master/src/Symfony/DependencyInjection/RegisterListenersPass.php

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions