From cf2f1db9bdc27741f41e29e7ad24e2550a2d624a Mon Sep 17 00:00:00 2001 From: Louis Chatriot Date: Fri, 3 May 2013 00:41:51 +0200 Subject: [PATCH] Benchmark for findone runs in half the time of find as expected --- benchmarks/find.js | 22 +--------------------- 1 file changed, 1 insertion(+), 21 deletions(-) diff --git a/benchmarks/find.js b/benchmarks/find.js index 6ecf3e4..bfc369b 100644 --- a/benchmarks/find.js +++ b/benchmarks/find.js @@ -65,7 +65,7 @@ async.waterfall([ } d.find({ docNumber: order[i] }, function (err, docs) { - if (docs.length !== 1) { return cb('One find didnt work'); } + if (docs.length !== 1 || docs[0].docNumber !== order[i]) { return cb('One find didnt work'); } process.nextTick(function () { find(i + 1); }); @@ -73,26 +73,6 @@ async.waterfall([ } find(0); } -//, function (cb) { - //var beg = new Date() - //, i = 0; - - //console.log("Finding " + n + " documents"); - - //async.whilst( function () { return i < n; } - //, function (_cb) { - //d.find({ docNumber: order[i] }, function (err, docs) { - //i += 1; - //if (docs.length !== 1) { return _cb(docs); } - //return _cb(err); - //}); - //}, function (err) { - //var timeTaken = (new Date()).getTime() - beg.getTime(); // In ms - //if (err) { return cb(err); } - //console.log("Time taken: " + (timeTaken / 1000) + "s"); - //return cb(); - //}); - //} ], function (err) { console.log("Benchmark finished");