Question

I'm building an web application in php, I've create my own MVC framework(for multiple reason, like more flexibility).

I have a caller method that call the right Method in the right controller automatically with posted data. But I was wondering about the execution time of ReflectionMethod to get the params with default value of the wanted method and call it with call_user_func_array.

Is it okay to use ReflectionMethod one time on each server side call or would be better to build an array with all controller/method with default parameter (Oblige me to call an ApplicationComplied each time I add or change a method signature) ?

Was it helpful?

Solution

Reflection is still significantly slower than direct calls. Two things have changed:

Runtimes have optimized reflection mechanisms so that the difference has become smaller CPUs have gotten faster so that small inefficiencies are easier to tolerate Together, these two factors have brought the cost of reflection down to the point where you can routinely use it.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top