I used webgrind and xdebug to get rid of the performance of my site. 85% of the page load time is taken as the function php :: PDO → __ construct (about 1 second) ...
this is unacceptable. can I somehow optimize this function? (caching, mysql configuration, etc.)
I am using php, mysql and codeigniter with redbean. redbean uses the pdo build function ...
here is the source code of the function
public function connect() {
if ($this->isConnected) return;
$user = $this->connectInfo['user'];
$pass = $this->connectInfo['pass'];
$this->pdo = new PDO(
$this->dsn,
$user,
$pass,
array(1002 => 'SET NAMES utf8',
PDO::ATTR_ERRMODE => PDO::ERRMODE_EXCEPTION,
PDO::ATTR_DEFAULT_FETCH_MODE => PDO::FETCH_ASSOC,
)
);
$this->pdo->setAttribute(PDO::ATTR_STRINGIFY_FETCHES, true);
$this->isConnected = true;
}
Mingo source
share