Welcome Guest, Not a member yet? Register   Sign In
Performance differences between libraries, classes and model
#1

[eluser]industrial[/eluser]
Hi,

I am currently creating an math based function that probably will be the most used in the whole application.

Sure, I can go ahead and put it straight into a model as any other database function, but could my server be happier if I put it anywhere else?

If I would make my own library of it, I could call it from inside an view or model as well?

Thanks,
#2

[eluser]jedd[/eluser]
Your server will likely be unhappy no matter what you do. Servers are like that.

If it does nothing other than math stuff - that is, it doesn't do any database access, or more importantly it doesn't require access to the CI superobject, then I'd suggest you stick it in a helper and autoload it.

If it does some database stuff, it might make more sense to turn it into a model (and perhaps autoload it).

If it's a fairly modest lump of code (parsing should be cheap) then you might want to stick it in MY_Controller.




Theme © iAndrew 2016 - Forum software by © MyBB