8000 Request controller argument is first resolved as Doctrine entity, causing 40-50ms performance loss · Issue #54337 · symfony/symfony · GitHub
[go: up one dir, main page]

Skip to content
Request controller argument is first resolved as Doctrine entity, causing 40-50ms performance loss #54337
Open
@Xesau

Description

@Xesau

Symfony version(s) affected

7.0.5

Description

For the tag controller.argument_value_resolver, the argument_resolver.request service has a priority of 50, while doctrine.orm.entity_value_resolver has a priority of 110. As a result, EntityValueResolver from DoctrineBundle first tries to resolve the Symfony\Component\HttpFoundation\Request controller argument as an entity. This is nonsensical and will cause Doctrine to try to find an entity manager and repository 65EC for it. In my case this leads to an extra 40-50ms of Total execution time on average.
By changing the priority of argument_resolver.request to 150, the Request argument is resolved immediately without this detour.

How to reproduce

Create a clean installation of symfony/skeleton and require symfony/webapp-pack. Create a controller with a Request $request function argument and visit it. Inspect the Performance profiler page for the request.

Possible Solution

No response

Additional Context

No response

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

      0