HI,
I'm not so familiar with your code, but profiling gives me the following result:
I've benchmarked Codeigniter 3.1.6's Welcome controller with the latest ion auth from git.
bare 499800 bytes
bare + session library 522880 bytes
bare + session library + ion_auth 776272 bytes
So for me the difference is 253392 bytes (0.24 MB) with which i can live with.
Also this is on PHP 7.1.11 which has lower memory usage compared to PHP 5.x.x
I've also checked what happens if i just load the ion_auth_model and create a copy of the logged_in() function locally.
The memory usage in that case was: 758864 bytes (0.225 MB), so for me it is not worth it to create a custom lib for this.
PHP Code:
public function loggedin()
{
$this->load->model('ion_auth_model');
$this->ion_auth_model->trigger_events('logged_in');
$recheck = $this->ion_auth_model->recheck_session();
// auto-login the user if they are remembered
if (!$recheck && get_cookie($this->config->item('identity_cookie_name', 'ion_auth')) && get_cookie($this->config->item('remember_cookie_name', 'ion_auth')))
{
$recheck = $this->ion_auth_model->login_remembered_user();
}
return $recheck;
}