开发者

Codeigniter HMVC effect on performance

开发者 https://www.devze.com 2023-03-12 08:24 出处:网络
OK, so HMVC in Codeigniter is the way to go for scalable web applications (with Kohana 3) based off many stackoverflow discussions such as HMVC patterns and MVC vs HMVC.

OK, so HMVC in Codeigniter is the way to go for scalable web applications (with Kohana 3) based off many stackoverflow discussions such as HMVC patterns and MVC vs HMVC.

But, how will using an HMVC approach affect performance when used in Codeigniter? From my understanding, HMVC will "simulate a controller". Assuming a one day "large" scale project, will Codeigniter's implementation by a future problem?开发者_如何学运维


There are two main different features that HMVC adds to CodeIgniter which often confuses people:

  1. Modular MVC
  2. Hierarchal MVC

Modular MVC is the feature that most people want to use and is essentially just a way to have a cleaner folder structure.

HMVC is the practise of calling controllers from other controllers without the need for a new HTTP request. This is very rarely useful in my opinion, other than for things like calling a custom 404 page or "widgets".

MMVC adds barely anything to performance, calling a controller via HMVC is obviously almost twice as slow.

Either way neither will be noticeable. If your site is starting to crawl under high traffic then this is one of the last things you'll need to worry about.


With HMVC you do not have to code your modules anymore as implemented in codeigniter. If a client needs a feature that you've already done in your previous project, you just copy it and drop inside your current project.

As implemented in codeigniter, you can do your coding as you use to do and only implement the features that you think require HMVC.

As for performance it depends on how you design your application in general.

0

精彩评论

暂无评论...
验证码 换一张
取 消

关注公众号