I am using Codeigniter and including Facebook library to implement Facebook authentication. I am autoloading the library as:
$autoload['libraries'] = array('database', 'session', 'facebook_lib', 'aescryption');
And the facebook_lib.php library is calling facebook.php (which in turn calls base_facebook.php). Now, this is making the site very slow. It takes around 4-8 seconds to load pages on my localhost. I didn't knew this earlier. The pages were loading really slow. I then profiled the application and found that even if I am just calling a blank page it was really slow. I then thought that something else is going on and my first thought was the autoload configs. If I remove the 'facebook_lib' library then the page loads right away.
Any ideas what can be done here? Has anyone encountered a similar problem?
Thanks.
UPDATE:
Here is the code that I have in facebook library: $this->ci =& get_instance();
// Create our Application instance
//(replace this with your appId and secret).
$this->ci->load->file(APPPATH.'/third_party/facebook.php');
$this->data['facebook'] = new Facebook(array(
'appId' => $this->ci->config->item('fb_app_id'),
'secret' => $this->ci->config->item('fb_secret_key')));
$this->data['fb_user'] = $this->data['facebook']->getUser();
if ($this->data['fb_user']) {
try {
$this->data['$user_profile']=$this->data['facebook']->api('/me');
$this->ci->load->model('login_signup_model');
$this->ci->login_signup_model->storeFBUser($this->data['$user_profile']['id']);
return true;
} catch (FacebookApiException $e){
error_log($e);
$this->data['fb_user']=null;
}
}