bench when document doesn't exist, it's the same story
This commit is contained in:
parent
2c6ca28fac
commit
318a980502
|
@ -1,10 +1,14 @@
|
||||||
var limit = 50 * 1000;
|
var limit = 50 * 1000;
|
||||||
var coll = db.relation;
|
var coll = db.relation;
|
||||||
|
var query = {
|
||||||
|
_id: 'thibault/legendary22bcloud'
|
||||||
|
};
|
||||||
|
var expected = false;
|
||||||
|
|
||||||
function timer(name, f) {
|
function timer(name, f) {
|
||||||
print('Start ' + name);
|
print('Start ' + name);
|
||||||
var start = new Date().getTime();
|
var start = new Date().getTime();
|
||||||
if (f() !== true) print('FAILS');
|
if (f() !== expected) print('FAILS');
|
||||||
else {
|
else {
|
||||||
for (var i = 0; i < limit; i++) f();
|
for (var i = 0; i < limit; i++) f();
|
||||||
print(name + ': ' + (new Date().getTime() - start));
|
print(name + ': ' + (new Date().getTime() - start));
|
||||||
|
@ -12,17 +16,11 @@ function timer(name, f) {
|
||||||
}
|
}
|
||||||
|
|
||||||
timer('count', function() {
|
timer('count', function() {
|
||||||
return coll.count({
|
return coll.count(query) === 1;
|
||||||
_id: 'thibault/legendarybcloud'
|
|
||||||
}) === 1;
|
|
||||||
});
|
});
|
||||||
timer('find', function() {
|
timer('find', function() {
|
||||||
return coll.find({
|
return coll.find(query).limit(1).length() === 1;
|
||||||
_id: 'thibault/legendarybcloud'
|
|
||||||
}).limit(1).length() === 1;
|
|
||||||
});
|
});
|
||||||
timer('findOne', function() {
|
timer('findOne', function() {
|
||||||
return coll.findOne({
|
return coll.findOne(query) !== null;
|
||||||
_id: 'thibault/legendarybcloud'
|
|
||||||
}) !== null;
|
|
||||||
});
|
});
|
||||||
|
|
Loading…
Reference in a new issue