Skip to content

Commit

Permalink
Updated benchmarks to show difference between { wrap: true } and { wr…
Browse files Browse the repository at this point in the history
…ap: false }
  • Loading branch information
notheotherben committed Feb 14, 2015
1 parent 84898de commit deff19c
Showing 1 changed file with 30 additions and 0 deletions.
30 changes: 30 additions & 0 deletions benchmarks/mongodb.js
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,12 @@ var model = new Iridium.Model(iDB, 'iridium', {
birthday: Date
});

var modelWrap = new Iridium.Model(iDB, 'iridiumWrap', {
name: String,
surname: String,
birthday: Date
});

iDB.register('model', model);

function printTime(format, start) {
Expand Down Expand Up @@ -67,6 +73,15 @@ MongoClient.connect('mongodb://localhost/iridium_bench', function(err, mDB) {
return done();
});
},
function(done) {
console.log('Iridium 10000 Inserts { w: 1, wrap: true }');
var start = new Date();
modelWrap.insert(objects, { w: 1, wrap: true }, function(err, inserted) {
if(err) return done(err);
printTime(' => %s', start);
return done();
});
},
function(done) {
console.log('MongoDB find()');
var start = new Date();
Expand All @@ -85,6 +100,15 @@ MongoClient.connect('mongodb://localhost/iridium_bench', function(err, mDB) {
return done();
});
},
function(done) {
console.log('Iridium find() { wrap: true }');
var start = new Date();
modelWrap.find({}, { wrap: true }, function(err, results) {
if(err) return done(err);
printTime(' => %s', start);
return done();
});
},
function(done) {
console.log('MongoDB remove()');
var start = new Date();
Expand All @@ -102,6 +126,12 @@ MongoClient.connect('mongodb://localhost/iridium_bench', function(err, mDB) {
printTime(' => %s', start);
return done();
});
},
function(done) {
modelWrap.remove(function(err, results) {
if(err) return done(err);
return done();
});
}
], function(err) {
if(err) throw err;
Expand Down

0 comments on commit deff19c

Please sign in to comment.