Performance fixes

This commit is contained in:
Dennis Eichhorn 2016-03-27 21:54:15 +02:00
parent e3171d38e3
commit 0978f41ca2
2 changed files with 4 additions and 2 deletions

View File

@ -102,7 +102,8 @@ class BruteForce
$population->addTour($tour);
}
for ($i = 0; $i < count($cities); $i++) {
$count = count($cities);
for ($i = 0; $i < $count; $i++) {
$extended = clone $tour;
$extended->addCity($cities[$i]);
unset($cities[$i]);

View File

@ -106,9 +106,10 @@ class Codebar extends C128Abstract
{
$codeString = '';
$length = strlen($this->content);
$lenCodearr = count(self::$CODEARRAY);
for ($posX = 1; $posX <= $length; $posX++) {
for ($posY = 0; $posY < count(self::$CODEARRAY); $posY++) {
for ($posY = 0; $posY < $lenCodearr; $posY++) {
if (substr($this->content, ($posX - 1), 1) == self::$CODEARRAY[$posY])
$codeString .= self::$CODEARRAY2[$posY] . '1';
}