Skip to content
This repository has been archived by the owner on Dec 11, 2020. It is now read-only.

Improve unique generator performance #491

Merged
merged 1 commit into from
Jan 4, 2015
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions src/Faker/UniqueGenerator.php
Original file line number Diff line number Diff line change
Expand Up @@ -41,8 +41,8 @@ public function __call($name, $arguments)
if ($i > $this->maxRetries) {
throw new \OverflowException(sprintf('Maximum retries of %d reached without finding a unique value', $this->maxRetries));
}
} while (in_array($res, $this->uniques[$name]));
$this->uniques[$name][]= $res;
} while (array_key_exists($res, $this->uniques[$name]));
$this->uniques[$name][$res]= null;

return $res;
}
Expand Down