I am a fairly experienced PHP developer, who is new to kohana.
I have built a website with Kohana, but after I uploaded to my server, I found part "Controller Setup" is unusually slow, took over 12s, whilst other take less than 0.5s,
Kohana Loading 0.014 1 0.49MB
Environment Setup 0.004 1 0.05MB
System Initialization 0.007 1 0.14MB
Controller Setup 12.058 1 1.42MB
ReflectionClass >newInstance() 12.054 1 1.35MB
Controller Execution 0.036 1 0.25MB
Total Execution 12.117 1 2.30MB
By digging into Kohana core, I have found ReflectionClass >newInstance() is causing the problem
But am not sure where I should go from here. :(
Help please. Thank you
I have dug deeper into my own code, looks like its Session::instance() whos causing the problem. Session::instance() 12.032 1 1.03MB
Further to my problem tracking, I have changed session driver to cache, and cache to memcache. But not much improvement. So I opened session.php, found this.
/**
* Singleton instance of Session.
*/
public static function instance()
{
if (Session::$instance == NULL)
{
// Create a new instance
new Session;
}
return Session::$instance;
}
-> "new Session;"!!
I can't see any point of this. I looked other classes, where it is written as return new xxx;