H
H
Hazrat Hajikerimov2014-07-05 12:54:59
PHP
Hazrat Hajikerimov, 2014-07-05 12:54:59

Singleton - Why does php script slow down?

private function __construct(){
        mysql_connect(self::Host,self::Root,self::Pass) or die (mysql_error());
        mysql_select_db(self::DB) or die  (mysql_error());
    }

    public static function getInstance (){
        if (empty(self::$instance)){
            self::$instance = new SQL();
        }
        return self::$instance;
    }

the execution time of this piece is 1 sec, why?

Answer the question

In order to leave comments, you need to log in

1 answer(s)
S
Sergey, 2014-07-05
@hazratgs

I suspect that your connection to the database is slowing down. As an option - a lot of time is spent on DNS resolving - just write the IP in the hostname.

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question