PHP 5 Reflection API performance

前端 未结 10 986
不知归路
不知归路 2020-12-02 20:11

I\'m currently considering the use of Reflection classes (ReflectionClass and ReflectionMethod mainly) in my own MVC web framework, because I need to automatically instancia

10条回答
  •  时光取名叫无心
    2020-12-02 20:24

    Don't be concerned. Install Xdebug and be sure where the bottleneck is.

    There is cost to using reflection, but whether that matters depends on what you're doing. If you implement controller/request dispatcher using Reflection, then it's just one use per request. Absolutely negligible.

    If you implement your ORM layer using reflection, use it for every object or even every access to a property, and create hundreds or thousands objects, then it might be costly.

提交回复
热议问题