Update benchmark works again

pull/2/head
Louis Chatriot 12 years ago
parent 32f568d063
commit c314e4f403
  1. 1
      benchmarks/commonUtilities.js
  2. 2
      benchmarks/update.js
  3. 1
      lib/datastore.js
  4. 2
      package.json

@ -156,6 +156,7 @@ module.exports.updateDocs = function (options, d, n, profiler, cb) {
// Will not actually modify the document but will take the same time
d.update({ docNumber: order[i] }, { docNumber: order[i] }, options, function (err, nr) {
if (err) { return cb(err); }
if (nr !== 1) { return cb('One update didnt work'); }
executeAsap(function () {
runFrom(i + 1);

@ -37,6 +37,8 @@ async.waterfall([
, function (cb) { profiler.beginProfiling(); return cb(); }
, async.apply(commonUtilities.insertDocs, d, n, profiler)
// CHECK THAT MULTIPLE LOAD DATABASE DONT SCREW INDEXES
// Test with update only one document
, function (cb) { profiler.step('MULTI: FALSE'); return cb(); }
, async.apply(commonUtilities.updateDocs, { multi: false }, d, n, profiler)

@ -198,6 +198,7 @@ Datastore.prototype._loadDatabase = function (cb) {
customUtils.ensureDirectoryExists(path.dirname(self.filename), function (err) {
fs.exists(self.filename, function (exists) {
if (!exists) {
self.resetIndexes();
self.datafileSize = 0;
fs.writeFile(self.filename, '', 'utf8', function (err) { return callback(err); });
return;

@ -22,7 +22,7 @@
"dependencies": {
"async": "~0.2.8",
"underscore": "~1.4.4",
"binary-search-tree": "0.1.3"
"binary-search-tree": "0.1.4"
},
"devDependencies": {
"chai": "1.0.x",

Loading…
Cancel
Save