Welcome Guest, Not a member yet? Register   Sign In
autoload performance
#1

[eluser]Xavier D.[/eluser]
Hi,

I'm working on a big site with CI, the models, helpers en library are becoming big.

Loading all the those things everytime in a class looks like overkill, now I see the autoload can help me with that, but what about performance, is there a difference in performance using the autoload?

thx
#2

[eluser]Xavier D.[/eluser]
wrong forum, can this be moved?
#3

[eluser]eilrahc[/eluser]
There will be a difference, but the exact different depends on your code, how much you are auto-loading, and what kind of load (in terms of page hits) your users will be generating.

I have three places where I load things:

1. The autoload feature of CI. Only put things in here that must be loaded on every single page view, period. I currently only have 'database' specified here.

2. The class constructor. Here's where you want to put load statements for code that will be used for all methods in the class, but which might not be needed for all classes.

3. The top of a method. If I'm loading a library or helper for use in one or two methods, it doesn't make sense to load it for every method in the class, so it goes here where it can be loaded on demand.




Theme © iAndrew 2016 - Forum software by © MyBB