Welcome Guest, Not a member yet? Register   Sign In
Split library into 2 versions, 'light' and 'complete', then call functions from either using just 1 library name.
#1

[eluser]tical[/eluser]
I have a library that is quite large in size and when loaded uses about 1.2mb of memory.

Most of functions in the library are rarely needed, whilst others are often used on every page.

To reduce the wasted memory usage, I want to split the library into 2 new libraries, a 'Light' version containing the common functions, and then another version that extends the light version with the remaining functions.

I can obviously do this by just simply creating 2 library files and calling the version I need on each page.
I have tried doing this and it reduces the memory usage to only 0.4mb for the Light version - exactly what I was looking to do.

However, a problem that occurred, is that it can start to get confusing as to which library contains what functions when calling them.

Provided that the correct library is initialised in the first place, for example:
Code:
$this->load->library('my_light_library');
or
Code:
$this->load->library('my_complete_library');

Is it possible to call functions from them using the same library name?
Code:
$this->my_library->my_function()


Messages In This Thread
Split library into 2 versions, 'light' and 'complete', then call functions from either using just 1 library name. - by El Forum - 03-03-2011, 01:01 AM



Theme © iAndrew 2016 - Forum software by © MyBB