2 ms·
This will kill your performance... function calls are slow, but calling them via call_user_func is crazy slow.
by jstsch 14y ago
This will kill your performance... function calls are slow, but calling them via call_user_func is crazy slow.
- chrisohara 14y agoIt's pretty negligible in the scheme of things. I was abusing PHP reflection a while back to add decorator support (https://github.com/chriso/Request https://github.com/chriso/Request) and used this pattern to reduce the cost: switch (count($args)) { case 0: $method(); break; case 1: $method($args[0]); break; case 2: $method($args[0], $args[1]); break; //etc default: call_user_func_array($method, $args); break; }