From deff19cf7cd2dc3fc6aec901560a381e95812aa4 Mon Sep 17 00:00:00 2001 From: Benjamin Pannell Date: Sat, 14 Feb 2015 18:53:10 +0200 Subject: [PATCH] Updated benchmarks to show difference between { wrap: true } and { wrap: false } --- benchmarks/mongodb.js | 30 ++++++++++++++++++++++++++++++ 1 file changed, 30 insertions(+) diff --git a/benchmarks/mongodb.js b/benchmarks/mongodb.js index 82ab1c1..99db7f6 100644 --- a/benchmarks/mongodb.js +++ b/benchmarks/mongodb.js @@ -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) { @@ -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(); @@ -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(); @@ -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;