Remove old benchmark code
This commit is contained in:
parent
a7c2b78ef1
commit
c9dd49dbd8
@ -1,17 +0,0 @@
|
||||
benchmark
|
||||
starting simple-query-parsing
|
||||
4166 ops/sec - (100/0.024)
|
||||
8333 ops/sec - (1000/0.12)
|
||||
10405 ops/sec - (10000/0.961)
|
||||
10515 ops/sec - (10000/0.951)
|
||||
10638 ops/sec - (10000/0.94)
|
||||
10460 ops/sec - (10000/0.956)
|
||||
starting prepared-statement-parsing
|
||||
4166 ops/sec - (100/0.024)
|
||||
8264 ops/sec - (1000/0.121)
|
||||
7530 ops/sec - (10000/1.328)
|
||||
8250 ops/sec - (10000/1.212)
|
||||
8156 ops/sec - (10000/1.226)
|
||||
8110 ops/sec - (10000/1.233)
|
||||
done
|
||||
|
@ -1,17 +0,0 @@
|
||||
benchmark
|
||||
starting simple-query-parsing
|
||||
3703 ops/sec - (100/0.027)
|
||||
7299 ops/sec - (1000/0.137)
|
||||
8888 ops/sec - (10000/1.125)
|
||||
8733 ops/sec - (10000/1.145)
|
||||
8810 ops/sec - (10000/1.135)
|
||||
8771 ops/sec - (10000/1.14)
|
||||
starting prepared-statement-parsing
|
||||
3846 ops/sec - (100/0.026)
|
||||
7299 ops/sec - (1000/0.137)
|
||||
7225 ops/sec - (10000/1.384)
|
||||
7288 ops/sec - (10000/1.372)
|
||||
7225 ops/sec - (10000/1.384)
|
||||
7457 ops/sec - (10000/1.341)
|
||||
done
|
||||
|
@ -1,17 +0,0 @@
|
||||
benchmark
|
||||
starting simple-query-parsing
|
||||
3571 ops/sec - (100/0.028)
|
||||
7299 ops/sec - (1000/0.137)
|
||||
8873 ops/sec - (10000/1.127)
|
||||
8536 ops/sec - (40000/4.686)
|
||||
8494 ops/sec - (40000/4.709)
|
||||
7695 ops/sec - (40000/5.198)
|
||||
starting prepared-statement-parsing
|
||||
4000 ops/sec - (100/0.025)
|
||||
6944 ops/sec - (1000/0.144)
|
||||
7153 ops/sec - (10000/1.398)
|
||||
7127 ops/sec - (40000/5.612)
|
||||
7208 ops/sec - (40000/5.549)
|
||||
6460 ops/sec - (40000/6.191)
|
||||
done
|
||||
|
@ -1,42 +0,0 @@
|
||||
var async = require('async');
|
||||
var max = 10000;
|
||||
var maxTimes = 3;
|
||||
var doLoops = function(bench, loops, times, cb) {
|
||||
var start = new Date();
|
||||
var count = 0;
|
||||
|
||||
var done = function() {
|
||||
var duration = (new Date() - start)
|
||||
var seconds = (duration / 1000);
|
||||
console.log("%d ops/sec - (%d/%d)", ~~(loops/seconds), loops, seconds);
|
||||
var next = loops * 10;
|
||||
if(next > max) {
|
||||
if(times > maxTimes) return cb();
|
||||
times++;
|
||||
next = max;
|
||||
}
|
||||
setTimeout(function() {
|
||||
doLoops(bench, next, times, cb);
|
||||
}, 100);
|
||||
}
|
||||
|
||||
var run = function() {
|
||||
if(count++ >= loops){
|
||||
return done();
|
||||
}
|
||||
bench(function() {
|
||||
setImmediate(run);
|
||||
});
|
||||
}
|
||||
run();
|
||||
}
|
||||
var bench = require(__dirname + '/simple-query-parsing');
|
||||
console.log();
|
||||
var benches = ['simple-query-parsing', 'prepared-statement-parsing'];
|
||||
async.forEachSeries(benches, function(name, cb) {
|
||||
var bench = require(__dirname + '/' + name)();
|
||||
console.log('starting ', name);
|
||||
doLoops(bench, 100, 1, cb);
|
||||
}, function(err, res) {
|
||||
console.log('done')
|
||||
})
|
@ -1,46 +0,0 @@
|
||||
var utils = require("../lib/utils");
|
||||
|
||||
var numArr = [];
|
||||
for (var i = 0; i < 1000; i++) numArr[i] = i;
|
||||
console.time("prepare-number-array");
|
||||
for (var i = 0; i < 100; i++) {
|
||||
utils.prepareValue(numArr);
|
||||
}
|
||||
console.timeEnd("prepare-number-array");
|
||||
|
||||
|
||||
var strArr = new Array(10000);
|
||||
console.time("prepare-string-array");
|
||||
for (var i = 0; i < 100; i++) {
|
||||
utils.prepareValue(strArr);
|
||||
}
|
||||
console.timeEnd("prepare-string-array");
|
||||
|
||||
|
||||
var objArr = [];
|
||||
for (var i = 0; i < 1000; i++) objArr[i] = { x: { y: 42 }};
|
||||
console.time("prepare-object-array");
|
||||
for (var i = 0; i < 100; i++) {
|
||||
utils.prepareValue(objArr);
|
||||
}
|
||||
console.timeEnd("prepare-object-array");
|
||||
|
||||
|
||||
var obj = { x: { y: 42 }};
|
||||
console.time("prepare-object");
|
||||
for (var i = 0; i < 100000; i++) {
|
||||
utils.prepareValue(obj);
|
||||
}
|
||||
console.timeEnd("prepare-object");
|
||||
|
||||
|
||||
var customType = {
|
||||
toPostgres: function () {
|
||||
return { toPostgres: function () { return new Date(); } };
|
||||
}
|
||||
};
|
||||
console.time("prepare-custom-type");
|
||||
for (var i = 0; i < 100000; i++) {
|
||||
utils.prepareValue(customType);
|
||||
}
|
||||
console.timeEnd("prepare-custom-type");
|
@ -1,73 +0,0 @@
|
||||
var Client = require(__dirname + '/../lib/client');
|
||||
var buffers = require(__dirname + '/../test/test-buffers');
|
||||
require(__dirname + '/../test/unit/test-helper');
|
||||
|
||||
var stream = new MemoryStream();
|
||||
stream.readyState = 'open';
|
||||
var client = new Client({
|
||||
stream: stream
|
||||
});
|
||||
|
||||
var rowDescription = new buffers.rowDescription([{
|
||||
name: 'id',
|
||||
tableID: 1,
|
||||
attributeNumber: 1,
|
||||
dataTypeID: 23, //int4
|
||||
typeModifer: 0,
|
||||
formatCode: 0
|
||||
},{
|
||||
name: 'name',
|
||||
tableID: 1,
|
||||
attributeNumber: 2,
|
||||
dataTypeID: 25, //text
|
||||
typeModifer: 0,
|
||||
formatCode: 0 //text format
|
||||
}, {
|
||||
name: 'comment',
|
||||
tableID: 1,
|
||||
attributeNumber: 3,
|
||||
dataTypeID: 25, //text
|
||||
typeModifer: 0,
|
||||
formatCode: 0 //text format
|
||||
}]);
|
||||
var row1 = buffers.dataRow(['1', 'Brian', 'Something groovy']);
|
||||
var row2 = buffers.dataRow(['2', 'Bob', 'Testint test']);
|
||||
var row3 = buffers.dataRow(['3', 'The amazing power of the everlasting gobstopper', 'okay now']);
|
||||
var parseCompleteBuffer = buffers.parseComplete();
|
||||
var bindCompleteBuffer = buffers.bindComplete();
|
||||
var portalSuspendedBuffer = buffers.portalSuspended();
|
||||
var complete = buffers.commandComplete('SELECT 3');
|
||||
var ready = buffers.readyForQuery();
|
||||
var buffer = Buffer.concat([parseCompleteBuffer,
|
||||
bindCompleteBuffer,
|
||||
rowDescription,
|
||||
row1,
|
||||
row2,
|
||||
row3,
|
||||
portalSuspendedBuffer,
|
||||
row1,
|
||||
row2,
|
||||
row3,
|
||||
portalSuspendedBuffer,
|
||||
row1,
|
||||
row2,
|
||||
row3,
|
||||
portalSuspendedBuffer,
|
||||
complete, ready]);
|
||||
|
||||
var bufferSlice = require('buffer-slice');
|
||||
var buffers = bufferSlice(10, buffer);
|
||||
|
||||
client.connect(assert.calls(function() {
|
||||
client.connection.emit('readyForQuery');
|
||||
module.exports = function() {
|
||||
return function(done) {
|
||||
client.query('SELECT * FROM whatever WHERE this = "doesnt even matter"', ['whatever'], function(err, res) {
|
||||
assert.equal(res.rows.length, 9);
|
||||
done();
|
||||
});
|
||||
buffers.forEach(stream.emit.bind(stream, 'data'));
|
||||
};
|
||||
};
|
||||
}));
|
||||
client.connection.emit('readyForQuery');
|
@ -1,59 +0,0 @@
|
||||
var Client = require(__dirname + '/../lib/client');
|
||||
var buffers = require(__dirname + '/../test/test-buffers');
|
||||
require(__dirname + '/../test/unit/test-helper');
|
||||
|
||||
var stream = new MemoryStream();
|
||||
stream.readyState = 'open';
|
||||
var client = new Client({
|
||||
stream: stream
|
||||
});
|
||||
|
||||
var rowDescription = new buffers.rowDescription([{
|
||||
name: 'id',
|
||||
tableID: 1,
|
||||
attributeNumber: 1,
|
||||
dataTypeID: 23, //int4
|
||||
typeModifer: 0,
|
||||
formatCode: 0
|
||||
},{
|
||||
name: 'name',
|
||||
tableID: 1,
|
||||
attributeNumber: 2,
|
||||
dataTypeID: 25, //text
|
||||
typeModifer: 0,
|
||||
formatCode: 0 //text format
|
||||
}, {
|
||||
name: 'comment',
|
||||
tableID: 1,
|
||||
attributeNumber: 3,
|
||||
dataTypeID: 25, //text
|
||||
typeModifer: 0,
|
||||
formatCode: 0 //text format
|
||||
}]);
|
||||
var row1 = buffers.dataRow(['1', 'Brian', 'Something groovy']);
|
||||
var row2 = buffers.dataRow(['2', 'Bob', 'Testint test']);
|
||||
var row3 = buffers.dataRow(['3', 'The amazing power of the everlasting gobstopper', 'okay now']);
|
||||
var complete = buffers.commandComplete('SELECT 3');
|
||||
var ready = buffers.readyForQuery();
|
||||
var buffer = Buffer.concat([
|
||||
rowDescription,
|
||||
row1, row2, row3,
|
||||
row1, row2, row3,
|
||||
row1, row2, row3,
|
||||
complete, ready]);
|
||||
var bufferSlice = require('buffer-slice');
|
||||
buffers = bufferSlice(10, buffer);
|
||||
|
||||
client.connect(assert.calls(function() {
|
||||
client.connection.emit('readyForQuery');
|
||||
module.exports = function() {
|
||||
return function(done) {
|
||||
client.query('SELECT * FROM whatever WHERE this = "doesnt even matter"', function(err, res) {
|
||||
assert.equal(res.rows.length, 9);
|
||||
done();
|
||||
});
|
||||
buffers.forEach(stream.emit.bind(stream, 'data'));
|
||||
};
|
||||
};
|
||||
}));
|
||||
client.connection.emit('readyForQuery');
|
Loading…
Reference in New Issue
Block a user