Removing redundant code that repeats actions for different number of parameters passed #33

Closed
wants to merge 1 commit into
from

Conversation

Projects
None yet
4 participants
@aramboyajyan

On several places the Dispatcher and Loader methods repeat the same action for different number of parameters passed. Finally, default handler works for any number of parameters.

This code seems to be redundant as the framework works as expected without those lines.

Have a look please and merge if works for you as well.

Thanks.

Removing redundant code that repeats actions for different number of …
…parameters passed. Using default fallback instead for all cases.
@mikecao

This comment has been minimized.

Show comment Hide comment
@mikecao

mikecao Apr 10, 2013

Owner

The code is like that for performance. Calling call_user_func_array is much slower than invoking the function directly, on average 3 times slower. The same is true with invoking ReflectionClass. It checks up to 5 parameters before trying the defaults, which should cover a majority of cases.

Owner

mikecao commented Apr 10, 2013

The code is like that for performance. Calling call_user_func_array is much slower than invoking the function directly, on average 3 times slower. The same is true with invoking ReflectionClass. It checks up to 5 parameters before trying the defaults, which should cover a majority of cases.

@warmwaffles

This comment has been minimized.

Show comment Hide comment
@warmwaffles

warmwaffles Apr 10, 2013

I agree with @mikecao. I've seen this done in other projects other than PHP for the exact same reason. It does obfuscate a bit, but the performance gain is worth it.

I agree with @mikecao. I've seen this done in other projects other than PHP for the exact same reason. It does obfuscate a bit, but the performance gain is worth it.

@warmwaffles

This comment has been minimized.

Show comment Hide comment
@warmwaffles

warmwaffles Apr 10, 2013

I agree with @mikecao. I've seen this done in other projects other than PHP for the exact same reason. It does obfuscate a bit, but the performance gain is worth it.

I agree with @mikecao. I've seen this done in other projects other than PHP for the exact same reason. It does obfuscate a bit, but the performance gain is worth it.

@aramboyajyan

This comment has been minimized.

Show comment Hide comment
@aramboyajyan

aramboyajyan Apr 10, 2013

Thanks for clarification.

Thanks for clarification.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment