Updated benchmarks for better readability

pull/2/head
Louis Chatriot 9 years ago
parent 65e7725095
commit 114556b993
  1. 13
      benchmarks/commonUtilities.js
  2. 1
      benchmarks/remove.js

@ -97,8 +97,10 @@ module.exports.insertDocs = function (d, n, profiler, cb) {
function runFrom(i) { function runFrom(i) {
if (i === n) { // Finished if (i === n) { // Finished
console.log("===== RESULT (insert) ===== " + Math.floor(1000* n / profiler.elapsedSinceLastStep()) + " ops/s"); var opsPerSecond = Math.floor(1000* n / profiler.elapsedSinceLastStep());
console.log("===== RESULT (insert) ===== " + opsPerSecond + " ops/s");
profiler.step('Finished inserting ' + n + ' docs'); profiler.step('Finished inserting ' + n + ' docs');
profiler.insertOpsPerSecond = opsPerSecond;
return cb(); return cb();
} }
@ -251,10 +253,11 @@ module.exports.removeDocs = function (options, d, n, profiler, cb) {
function runFrom(i) { function runFrom(i) {
if (i === n) { // Finished if (i === n) { // Finished
console.log("===== RESULT (1 remove + 1 insert) ===== " + Math.floor(1000* n / profiler.elapsedSinceLastStep()) + " ops/s"); // opsPerSecond corresponds to 1 insert + 1 remove, needed to keep collection size at 10,000
console.log("====== IMPORTANT: Please note that this is the time that was needed to perform " + n + " removes and " + n + " inserts"); // We need to subtract the time taken by one insert to get the time actually taken by one remove
console.log("====== The extra inserts are needed to keep collection size at " + n + " items for the benchmark to make sense"); var opsPerSecond = Math.floor(1000 * n / profiler.elapsedSinceLastStep());
console.log("====== Use the insert speed logged above to calculate the actual remove speed, which is higher (should be significantly so if you use indexing)"); var removeOpsPerSecond = Math.floor(1 / ((1 / opsPerSecond) - (1 / profiler.insertOpsPerSecond)))
console.log("===== RESULT (remove) ===== " + removeOpsPerSecond + " ops/s");
profiler.step('Finished removing ' + n + ' docs'); profiler.step('Finished removing ' + n + ' docs');
return cb(); return cb();
} }

@ -26,7 +26,6 @@ async.waterfall([
// Test with remove only one document // Test with remove only one document
, function (cb) { profiler.step('MULTI: FALSE'); return cb(); } , function (cb) { profiler.step('MULTI: FALSE'); return cb(); }
, async.apply(commonUtilities.removeDocs, { multi: false }, d, n, profiler) , async.apply(commonUtilities.removeDocs, { multi: false }, d, n, profiler)
// Test with multiple documents // Test with multiple documents
, function (cb) { d.remove({}, { multi: true }, function () { return cb(); }); } , function (cb) { d.remove({}, { multi: true }, function () { return cb(); }); }
, async.apply(commonUtilities.insertDocs, d, n, profiler) , async.apply(commonUtilities.insertDocs, d, n, profiler)

Loading…
Cancel
Save