first post

This commit is contained in:
2012-05-25 09:03:56 -04:00
commit 6a753904b7
609 changed files with 252648 additions and 0 deletions

View File

@@ -0,0 +1,39 @@
// Last v8 profile when running this test for 500k rows:
// https://gist.github.com/f85c38010c038e5efe2e
var common = require('../../test/common');
var Client = require('../../lib/client'),
client = common.createClient(),
rows = 0;
client.typeCast = false;
client.query('CREATE DATABASE '+common.TEST_DB, function(err) {
//if (err && err.number != Client.ERROR_DB_CREATE_EXISTS) {
//throw err;
//}
});
client.query('USE '+common.TEST_DB);
var selectStart = +new Date;
function query() {
client
.query('SELECT * FROM '+common.TEST_TABLE)
.on('row', function(row) {
rows++;
})
.on('end', function() {
if (rows < 10000) {
query();
return;
}
var duration = (+new Date - selectStart) / 1000,
rowsPerSecond = rows / duration;
console.log('%d rows / second', rowsPerSecond.toFixed(2));
console.log('%d ms', +new Date - selectStart);
client.end();
});
}
query();