A Twitch.tv viewer reward and games system.
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
 

42 lines
845 B

var common = require('../test/common');
var client = common.createConnection({typeCast: false});
var rowsPerRun = 100000;
client.connect(function(err) {
if (err) throw err;
client.query('USE node_mysql_test', function(err, results) {
if (err) throw err;
selectRows();
});
});
var firstSelect;
var rowCount = 0;
console.error('Benchmarking rows per second in hz:');
function selectRows() {
firstSelect = firstSelect || Date.now();
client.query('SELECT * FROM posts', function(err, rows) {
if (err) throw err;
rowCount += rows.length;
if (rowCount < rowsPerRun) {
selectRows();
return;
}
var duration = (Date.now() - firstSelect) / 1000;
var hz = Math.round(rowCount / duration);
console.log(hz);
rowCount = 0;
firstSelect = null;
selectRows();
});
};