php _call call_user_func_array,PHP: call_user_func - Manual

@insta at citiesunlimited dot com & @Maresa

call_user_func() alleged slowness is quite over estimated when it comes to real use cases. we are talking about loosing fraction of a second every million calls, which by the way would take less than half a sec to execute in the worst case.

I don't know of many processes that would actually suffer from this kind of overhead.

Iterations: 100 000

Averaged over: 10

PHP 5.6.30 (cli) (built: Jan 18 2017 19:47:28)

Overall Average

+------------------------+----------+-----------+--------+

| Invocation             | Time (s) | Delta (s) | %      |

+------------------------+----------+-----------+--------+

| directFunction         | 0.0089   | -0.0211   | -70.19 |

| directStatic           | 0.0098   | -0.0202   | -67.39 |

| directLambda           | 0.0109   | -0.0191   | -63.52 |

| directInstance         | 0.0116   | -0.0184   | -61.31 |

| directClosure          | 0.0150   | -0.0150   | -50.15 |

| Invoke                 | 0.0282   | -0.0018   | -6.13  |

| call_user_func         | 0.0300   |           |        |

| ClosureFactory         | 0.0316   | +0.0016   | +5.20  |

| assignedClosureFactory | 0.0328   | +0.0028   | +9.28  |

| call_user_func_array   | 0.0399   | +0.0099   | +33.02 |

| InvokeCallUserFunc     | 0.0418   | +0.0118   | +39.17 |

| directImplementation   | 0.0475   | +0.0175   | +58.28 |

+------------------------+----------+-----------+--------+

Iterations: 100 000

Averaged over: 10

PHP 7.1.2 (cli) (built: Feb 14 2017 21:24:45)

Overall Average

+------------------------+----------+-----------+--------+

| Invocation             | Time (s) | Delta (s) | %      |

+------------------------+----------+-----------+--------+

| directFunction         | 0.0043   | -0.0096   | -68.92 |

| directStatic           | 0.0050   | -0.0089   | -64.04 |

| directInstance         | 0.0058   | -0.0081   | -58.22 |

| directLambda           | 0.0063   | -0.0075   | -54.44 |

| directClosure          | 0.0081   | -0.0058   | -41.57 |

| call_user_func         | 0.0139   |           |        |

| call_user_func_array   | 0.0147   | +0.0008   | +5.84  |

| Invoke                 | 0.0187   | +0.0048   | +34.61 |

| ClosureFactory         | 0.0207   | +0.0069   | +49.43 |

| assignedClosureFactory | 0.0219   | +0.0080   | +57.75 |

| directImplementation   | 0.0232   | +0.0094   | +67.53 |

| InvokeCallUserFunc     | 0.0264   | +0.0126   | +90.67 |

+------------------------+----------+-----------+--------+

If you want more details : https://github.com/fab2s/call_user_func

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值