-
-
Notifications
You must be signed in to change notification settings - Fork 16
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
Drop unnecessary InterfaceToCall references in container #348
Drop unnecessary InterfaceToCall references in container #348
Conversation
public function getInterfaceToCall(): InterfaceToCall | ||
{ | ||
return $this->interceptedMessageProcessor->getInterfaceToCall(); | ||
return InterfaceToCall::create($this->getObjectToInvokeOn(), $this->getMethodName()); | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I supposed MethodInvocation
was public API, so I kept getInterfaceToCall()
in the interface and used this fallback.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This will now need to resolve the Interface using reflection on run time. Let's drop this method then, so we won't accidentally use it.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Feel free to merge and do it as follow up
43260fc
to
b92564a
Compare
I can see in benchmark having better performance on run time with symfony, which dumps the container. I wonder what's the reasoning behind it. |
Maybe, this is the only rationale I have. But yes, InterfaceToCall may be quite expensive to load as there are a lot of objects to get from the container (InterfaceParameters and attributes) |
Description
InterfaceToCall are actually registered in the container, and there is a lot of registrations (InterfaceToCall, InterfaceParameter, Attributes).
This PR avoids injecting unnecessary InterfaceToCall references for service activators.
On a medium sized symfony project, I got 1000 objects dropped from the container after this PR, and got a 10% speed boost on cache:clear.
Type of change