most efficient way of loading views - Printable Version +- CodeIgniter Forums (https://forum.codeigniter.com) +-- Forum: Archived Discussions (https://forum.codeigniter.com/forumdisplay.php?fid=20) +--- Forum: Archived Development & Programming (https://forum.codeigniter.com/forumdisplay.php?fid=23) +--- Thread: most efficient way of loading views (/showthread.php?tid=53752) |
most efficient way of loading views - El Forum - 08-07-2012 [eluser]brian88[/eluser] Ive been loading view by using a template. But I wanna know which is the fastest way, not for me, but for users to download the page. So here I have 2 controllers and I wanna know whats the better way. Or if theres a better way other than these 2 options, give me some feedback( I dont want to use a big templating library, not a fan ) controller 1 Code: // set SEO In this one I pass data to views that don't even need it, which would slow down the page, correct? or controller 2 Code: // set SEO This one takes longer to do, but if the page loads faster for users then I dont mind doing it. most efficient way of loading views - El Forum - 08-07-2012 [eluser]TWP Marketing[/eluser] This is just an opinion. I use something like your controller 1, passing superfluous data to some views which don't actually use it. I agree that the technique in controller 2 results in faster rendering of pages. As a lazy coder, I don't always take the time to sort my data and pass only as much as needed for each view. Slap on the wrist for me... Justification: The amount of date being passed is small, usually. The data array is passed by reference, hence the server isn't being beaten on as much as a full data copy would cause. I look forward to hearing for others on this topic. |