This code takes ~ 0.1 s
$benchmark = Profiler::start ('Testing', 'find()');
$cursor = MongoBG::getInstance ( )->setDatabase ('test')->setCollection ('testcoll')->find();
Profiler::stop ($benchmark);
$benchmark = Profiler::start ('Testing', 'cursor walk');
while ($cursor->hasNext()) {
print_r($cursor->getNext());
}
Profiler::stop ($benchmark);
therefore, "find ()" took only 0.000017 seconds but a "cursor move" of 0.102812 seconds
The collection has about 100 lines, the speed remains unchanged with 1000 or only 10 elements in it.
Server information: FreeBSD 8.1, PHP 5.3.5 c (mongo / 1.1.4), version MongoDB 1.6.6-pre
source
share