speedtest->coll; $counter = 0; $start = microtime(true); $this->log("Time:\t" . $start); while ($counter++ < 1000000) { $collection->insert(array('counter' => $counter), array('safe' => $this->safe)); } $end = microtime(true); $this->log("Start:\t" . $start); $this->log("End:\t" . $end); $this->log("Diff:\t" . ($end - $start)); $this->log("Avg:\t" . number_format($counter / ($end - $start), 2) . "/s"); } protected function log($str) { echo "{$str}\n"; } } $test = new SpeedTest(); $test->run();