Skip to content

Instantly share code, notes, and snippets.

@anatoliychakkaev
Created October 18, 2012 14:35
Show Gist options
  • Save anatoliychakkaev/3912273 to your computer and use it in GitHub Desktop.
Save anatoliychakkaev/3912273 to your computer and use it in GitHub Desktop.
Jugglingdb benchmark
var limit = 10;
var success = 0;
var Schema = require('./').Schema;
var AC = require('./').AbstractClass;
var s = new Schema('redis2', {});
var util = require('util');
s.setMaxListeners(100);
var Model = s.define('Model', {
prop: String,
json1: function JSON() {},
json2: function JSON() {},
json3: function JSON() {},
p1: String,
p2: String,
p3: String,
pd1: Date,
pd2: Date,
pb: Boolean
});
var i = 0;
function benchmark() {
var time = Date.now();
Model.all(function (err, data) {
data.forEach(function (el) {
el.p1 = el.p2;
});
console.log(i, Date.now() - time, Math.round(process.memoryUsage().heapUsed / 1024 / 1024), Math.round(process.memoryUsage().heapTotal / 1024 / 1024));
if (++i < 50) return benchmark();
else s.disconnect();
});
};
benchmark();
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment