Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Codeigniter HMVC effect on performance

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?

like image 529
csi Avatar asked Oct 20 '25 19:10

csi


2 Answers

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.

like image 157
Phil Sturgeon Avatar answered Oct 23 '25 10:10

Phil Sturgeon


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.

like image 22
Ernest Boabramah Avatar answered Oct 23 '25 10:10

Ernest Boabramah



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!