【问题标题】:Controller performance in codeignitercodeigniter 中的控制器性能
【发布时间】:2014-01-17 10:08:13
【问题描述】:

对控制器类响应的最大 LOC(LINE OF CODE) 影响是否...这很重要吗..

 1.a)Controller: LOC 120, public functions exist 3.
   b)Controller: LOC 120, public functions exist 3.
   c)Controller: LOC 120, public functions exist 3.

 2.) Controller LOC 720, pubic function 10.
   it handle all the things in the same class.

哪个更好?

【问题讨论】:

  • 我认为第一个比第二个更快,所以首先

标签: php codeigniter micro-optimization lines-of-code


【解决方案1】:

Codeigniter 内置了benchmarking 工具。您可以使用它来确定哪个更快。

但是如果你的应用程序很慢,那不太可能是控制器类中的行数或方法数。更有可能是数据库查询、API 调用等。在这种情况下,您应该考虑优化这些东西或缓存结果。

您应该按照 MVC 模式以一种有意义且易于阅读的方式组织您的代码。

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 2012-04-06
    • 1970-01-01
    • 2015-11-25
    • 2011-07-27
    • 2020-11-17
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多