rendered paste body<center><div style="width: 500px; height: 200px; overflow: scroll"><?php$db='benchmark';$host='localhost';$pass='';$user='root';$results = 10000;$mysqli=mysqli_connect($host,$user,$pass,$db);$pdo=new PDO('mysql:dbname='.$db.';host='.$host,$user,$pass);$pdo->setAttribute(PDO::ATTR_ERRMODE,PDO::ERRMODE_EXCEPTION);$mysqlo=new MySQLi($host,$user,$pass,$db);$old=mysql_connect($host,$user,$pass);mysql_select_db($db,$old);$t1=array();$t2=array();$t3=array();$t4=array();echo '';#MySQLi - proceduralfor($i=0;$i<$results;$i++){ #MySQL $t=microtime(true); $res=mysql_query('SELECT title,created,option1,floatnum,text FROM test',$old);/* while($array=mysql_fetch_assoc($res)) { echo $array['floatnum'].' - '; }*/ $t1[$i]=microtime(true)-$t; mysql_free_result($res); unset($res,$array); #MySQLi - proceduralny $t=microtime(true); $res=mysqli_query($mysqli,'SELECT title,created,option1,floatnum,text FROM test',MYSQLI_USE_RESULT);/* while($array=mysqli_fetch_assoc($res)) { echo $array['floatnum'].' - '; }*/ $t2[$i]=microtime(true)-$t; mysqli_free_result($res); unset($res,$array); #MySQLi - obiektowy $t=microtime(true); $res=$mysqlo->query('SELECT title,created,option1,floatnum,text FROM test',MYSQLI_USE_RESULT);/* while($array=$res->fetch_assoc()) { echo $array['floatnum'].' - '; }*/ $t3[$i]=microtime(true)-$t; $res->free(); unset($res,$array); #PDO $t=microtime(true); $res=$pdo->query('SELECT title,created,option1,floatnum,text FROM test'); $res->setFetchMode(PDO::FETCH_ASSOC);/* while($array = $res->fetch()) { echo $array['floatnum'].'<br /><br />'; }*/ $t4[$i]=microtime(true)-$t; $res->closeCursor(); unset($res); unset($array);}#Zestawienie?></div><table cellspacing="9" cellpadding="3"><tr> <th>Count</th> <th>MySQL (proc.)</th> <th>MySQLi (proc.)</th> <th>MySQLi (obj)</th> <th>PDO →</th></tr><?php$ile=$results;//count($t1);$mavg = array();$minmax = array();for($i=0,$ii=0;$i<$ile;++$i){ $min=min($t1[$i],$t2[$i],$t3[$i],$t4[$i]); $max=max($t1[$i],$t2[$i],$t3[$i],$t4[$i]); echo ' <tr> <td>'.++$ii.'.</td>'; for ($x = 1; $x < 5; $x++) { if (!isset($mavg[$x])) $mavg[$x] = 0; $mavg[$x] += (${"t$x"}[$i]) * 1000; if($min==${"t$x"}[$i]) { echo '<td style="color: green">'; if (!isset($minmax['max'][$x])) $minmax['max'][$x] = 0; $minmax['max'][$x] += 1; } elseif($max==${"t$x"}[$i]) { echo '<td style="color: red">'; if (!isset($minmax['min'][$x])) $minmax['min'][$x] = 0; $minmax['min'][$x] += 1; } else { echo '<td>'; } echo ${"t$x"}[$i]*1000 .' ms</td>'; } echo '</tr>';}echo '<tr><td> Stats: </td>';for ($x = 1; $x < 5; $x++) { echo '<td>Avg : '. ($mavg[$x] / $results) . ' ms <br />Max : '.$minmax['max'][$x] .' <br />Min : '.$minmax['min'][$x].'<br />Mid : '.($results - $minmax['min'][$x] - $minmax['max'][$x]).'</td>';}?></tr></table></center>