<i id='CxhMU'><tr id='CxhMU'><dt id='CxhMU'><q id='CxhMU'><span id='CxhMU'><b id='CxhMU'><form id='CxhMU'><ins id='CxhMU'></ins><ul id='CxhMU'></ul><sub id='CxhMU'></sub></form><legend id='CxhMU'></legend><bdo id='CxhMU'><pre id='CxhMU'><center id='CxhMU'></center></pre></bdo></b><th id='CxhMU'></th></span></q></dt></tr></i><div id='CxhMU'><tfoot id='CxhMU'></tfoot><dl id='CxhMU'><fieldset id='CxhMU'></fieldset></dl></div>

    <small id='CxhMU'></small><noframes id='CxhMU'>

  1. <tfoot id='CxhMU'></tfoot>
      • <bdo id='CxhMU'></bdo><ul id='CxhMU'></ul>
      <legend id='CxhMU'><style id='CxhMU'><dir id='CxhMU'><q id='CxhMU'></q></dir></style></legend>

    1. PHP 5 反射 API 性能

      时间:2023-09-22
      • <bdo id='EsuFi'></bdo><ul id='EsuFi'></ul>
        <tfoot id='EsuFi'></tfoot>
        • <small id='EsuFi'></small><noframes id='EsuFi'>

          <legend id='EsuFi'><style id='EsuFi'><dir id='EsuFi'><q id='EsuFi'></q></dir></style></legend>

              <tbody id='EsuFi'></tbody>

              <i id='EsuFi'><tr id='EsuFi'><dt id='EsuFi'><q id='EsuFi'><span id='EsuFi'><b id='EsuFi'><form id='EsuFi'><ins id='EsuFi'></ins><ul id='EsuFi'></ul><sub id='EsuFi'></sub></form><legend id='EsuFi'></legend><bdo id='EsuFi'><pre id='EsuFi'><center id='EsuFi'></center></pre></bdo></b><th id='EsuFi'></th></span></q></dt></tr></i><div id='EsuFi'><tfoot id='EsuFi'></tfoot><dl id='EsuFi'><fieldset id='EsuFi'></fieldset></dl></div>
              • 本文介绍了PHP 5 反射 API 性能的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

                问题描述

                我目前正在考虑在我自己的 MVC Web 框架中使用反射类(主要是 ReflectionClass 和 ReflectionMethod),因为我需要自动实例化控制器类并调用它们的方法而无需任何必需的配置(约定优于配置"方法).

                I'm currently considering the use of Reflection classes (ReflectionClass and ReflectionMethod mainly) in my own MVC web framework, because I need to automatically instanciate controller classes and invoke their methods without any required configuration ("convention over configuration" approach).

                我担心性能,尽管我认为数据库请求可能比实际的 PHP 代码成为更大的瓶颈.

                I'm concerned about performance, even though I think that database requests are likely to be bigger bottlenecks than the actual PHP code.

                所以,我想知道从性能的角度来看,是否有人对 PHP 5 反射有任何好的或坏的经验.

                So, I'm wondering if anyone has any good or bad experience with PHP 5 Reflection from a performance point of view.

                此外,我很想知道是否有任何一种流行的 PHP 框架(CI、Cake、Symfony 等)实际使用了反射.

                Besides, I'd be curious to know if any one of the popular PHP frameworks (CI, Cake, Symfony, etc.) actually use Reflection.

                推荐答案

                别担心.安装 Xdebug 并确定瓶颈在哪里.

                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.

                如果您使用反射实现 ORM 层,将其用于每个对象甚至对属性的每次访问,并创建数百或数千个对象,那么成本可能会很高.

                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.

                这篇关于PHP 5 反射 API 性能的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持html5模板网!

                上一篇:PHP 反射 - 获取方法参数类型为字符串 下一篇:如何区分表示元素和属性的 SimpleXML 对象?

                相关文章

                最新文章

                <small id='e9X6y'></small><noframes id='e9X6y'>

                1. <legend id='e9X6y'><style id='e9X6y'><dir id='e9X6y'><q id='e9X6y'></q></dir></style></legend>
                  • <bdo id='e9X6y'></bdo><ul id='e9X6y'></ul>

                    <tfoot id='e9X6y'></tfoot>
                    <i id='e9X6y'><tr id='e9X6y'><dt id='e9X6y'><q id='e9X6y'><span id='e9X6y'><b id='e9X6y'><form id='e9X6y'><ins id='e9X6y'></ins><ul id='e9X6y'></ul><sub id='e9X6y'></sub></form><legend id='e9X6y'></legend><bdo id='e9X6y'><pre id='e9X6y'><center id='e9X6y'></center></pre></bdo></b><th id='e9X6y'></th></span></q></dt></tr></i><div id='e9X6y'><tfoot id='e9X6y'></tfoot><dl id='e9X6y'><fieldset id='e9X6y'></fieldset></dl></div>