Skip to content

Commit

Permalink
Make benchmarks more comparable
Browse files Browse the repository at this point in the history
  • Loading branch information
felixge committed Oct 9, 2010
1 parent ad299e8 commit f692d90
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 3 deletions.
2 changes: 1 addition & 1 deletion benchmark/mysql/insert-select.js
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ client.query(

var start = +new Date, inserts = 0, total = 10000;
function insertOne() {
client.query('INSERT INTO '+TEST_TABLE+' SET title = ?', ['super'], function() {
client.query('INSERT INTO '+TEST_TABLE+' SET title = "aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa"', function() {
inserts++;
if (inserts < total) {
insertOne();
Expand Down
4 changes: 2 additions & 2 deletions benchmark/php/insert-select.php
Original file line number Diff line number Diff line change
Expand Up @@ -22,15 +22,15 @@

$start = microtime(true);
for ($i = 0; $i < $INSERTS; $i++) {
mysql_query('INSERT INTO '.$table.' SET title = "super";', $connection);
mysql_query('INSERT INTO '.$table.' SET title = "aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa";', $connection);
}
$duration = (microtime(true) - $start);
$insertsPerSecond = $INSERTS / $duration;
echo sprintf("%d inserts / second\n", $insertsPerSecond);

$start = microtime(true);
$q = mysql_query('SELECT * FROM '.$table);
while ($a = mysql_fetch_row($q)) {
while ($a = mysql_fetch_assoc($q)) {
}
$duration = (microtime(true) - $start);
$rowsPerSecond = $INSERTS / $duration;
Expand Down

0 comments on commit f692d90

Please sign in to comment.