summaryrefslogtreecommitdiff
path: root/jstests/perf/remove1.js
diff options
context:
space:
mode:
Diffstat (limited to 'jstests/perf/remove1.js')
-rw-r--r--jstests/perf/remove1.js52
1 files changed, 24 insertions, 28 deletions
diff --git a/jstests/perf/remove1.js b/jstests/perf/remove1.js
index 3e1a1a6b71c..09f1948572b 100644
--- a/jstests/perf/remove1.js
+++ b/jstests/perf/remove1.js
@@ -10,16 +10,16 @@ var msg = "Hello from remove test";
function testSetup(dbConn) {
var t = dbConn[collection_name];
t.drop();
- t.ensureIndex( { num : 1 } );
+ t.ensureIndex({num: 1});
- for (var i=0; i<size; i++){
- t.save({ num : i, msg : msg });
+ for (var i = 0; i < size; i++) {
+ t.save({num: i, msg: msg});
}
}
-function between( low, high, val, msg ) {
- assert( low < val, msg );
- assert( val < high, msg );
+function between(low, high, val, msg) {
+ assert(low < val, msg);
+ assert(val < high, msg);
}
/**
@@ -29,40 +29,36 @@ function between( low, high, val, msg ) {
* @param dbConn
*/
function testRemoveWithMultiField(dbConn) {
-
var results = {};
var t = dbConn[collection_name];
testSetup(dbConn);
- t.remove( {num:0 } );
- results.indexOnly = Date.timeFunc(
- function(){
- for (var i = 1; i < removals; i++) {
- t.remove({num : i});
- }
-
- t.findOne();
+ t.remove({num: 0});
+ results.indexOnly = Date.timeFunc(function() {
+ for (var i = 1; i < removals; i++) {
+ t.remove({num: i});
}
- );
+
+ t.findOne();
+ });
testSetup(dbConn);
-
- t.remove( {num: 0, msg: msg } );
- results.withAnother = Date.timeFunc(
- function(){
- for (var i = 1; i < removals; i++) {
- t.remove({num : i, msg : msg});
- }
- t.findOne();
+ t.remove({num: 0, msg: msg});
+ results.withAnother = Date.timeFunc(function() {
+ for (var i = 1; i < removals; i++) {
+ t.remove({num: i, msg: msg});
}
- );
+ t.findOne();
+ });
- between( 0.65, 1.35, (results.indexOnly / results.withAnother),
- "indexOnly / withAnother (" + results.indexOnly + " / " + results.withAnother + " ) = " +
- results.indexOnly / results.withAnother + " not in [0.65, 1.35]" );
+ between(0.65,
+ 1.35,
+ (results.indexOnly / results.withAnother),
+ "indexOnly / withAnother (" + results.indexOnly + " / " + results.withAnother +
+ " ) = " + results.indexOnly / results.withAnother + " not in [0.65, 1.35]");
}
testRemoveWithMultiField(db);