Does dependency injection in laravel controller slow down application performance?

Issue

This Content is from Stack Overflow. Question asked by Efthakhar Bin

I am not a computer science background student. So I have no idea how much space complexity created by calling a laravel controller method. From a senior developer podcast I came to know that every variable, function, class created by us in program take space in memory.

Now from this perspective, my confusion is —-

when I call a controller method of laravel for a route, laravel create a instance of whole controller class. But I use only one method that time. Here other methods remain unused.

Is not it a bad impact on performance issue of application? If so, what is the solution ?



Solution

This question is not yet answered, be the first one who answer using the comment. Later the confirmed answer will be published as the solution.

This Question and Answer are collected from stackoverflow and tested by JTuto community, is licensed under the terms of CC BY-SA 2.5. - CC BY-SA 3.0. - CC BY-SA 4.0.

people found this article helpful. What about you?