summaryrefslogtreecommitdiff
path: root/jstests/perf
diff options
context:
space:
mode:
authorEliot Horowitz <eliot@10gen.com>2009-11-13 17:27:54 -0500
committerEliot Horowitz <eliot@10gen.com>2009-11-13 17:27:54 -0500
commit9d9600893812bc2d8def36ad9aacdb923556074b (patch)
tree1837d7d1bd373a5dc62dd23e3135b1c074ecb795 /jstests/perf
parent7db9f7ee87339b703d309f97fa20c17e243c5bad (diff)
downloadmongo-9d9600893812bc2d8def36ad9aacdb923556074b.tar.gz
some index perf test
Diffstat (limited to 'jstests/perf')
-rw-r--r--jstests/perf/index1.js20
1 files changed, 20 insertions, 0 deletions
diff --git a/jstests/perf/index1.js b/jstests/perf/index1.js
new file mode 100644
index 00000000000..7bcf4b71ab1
--- /dev/null
+++ b/jstests/perf/index1.js
@@ -0,0 +1,20 @@
+
+t = db.perf.index1;
+t.drop();
+
+for ( var i=0; i<100000; i++ ){
+ t.save( { x : i } );
+}
+
+t.findOne();
+
+printjson( db.serverStatus().mem );
+
+for ( var i=0; i<5; i++ ){
+ nonu = Date.timeFunc( function(){ t.ensureIndex( { x : 1 } ); } );
+ t.dropIndex( { x : 1 } );
+ u = Date.timeFunc( function(){ t.ensureIndex( { x : 1 }, { unique : 1 } ); } );
+ t.dropIndex( { x : 1 } );
+ print( "non unique: " + nonu + " unique: " + u );
+ printjson( db.serverStatus().mem );
+}