php - PDO object performance -
i tested today pdo performance :
<?php $start = microtime(true); new pdo("mysql:host=localhost;dbname=mw", 'root', ''); $stop = microtime(true); echo $stop - $start;
and result pretty surprising (running locally on windows 8.1 laptop)
ellapsed : 1.0117259025574
during script execution, cache pdo object in static variable don't have create new 1 query. caching method works during script execution.
my script runs in 1.25 seconds of 1.01 used create pdo object. there way cache pdo object whole session or multiple users ?
am missing ?
i tested same code on server , connecting db via pdo .
$start time 1414590258.7735 $end time 1414590258.7736 , $end time- $start time 0.0001530647277832
my code
enter code here $start = microtime(true); new pdo("mysql:host=$mysqlnd_appname1;dbname=$db1",$user1,$pass1); $stop = microtime(true); echo($start); echo "<br />"; echo $stop; echo "<br />"; echo $stop - $start;
so pdo connection performance , depend on sever , how sql server respond php server. more details visit http://archive.jnrbsn.com/2010/06/mysqli-vs-pdo-benchmarks
php mysql performance pdo
No comments:
Post a Comment