Minor performance tweaks

This commit is contained in:
Mark Baker 2013-04-26 12:44:47 +01:00
parent 8a05ee8896
commit 8debf76a8a
5 changed files with 15 additions and 15 deletions

View File

@ -177,7 +177,7 @@ abstract class PHPExcel_CachedObjectStorage_CacheBase {
public function getSortedCellList() {
$sortKeys = array();
foreach ($this->getCellList() as $coord) {
list($column,$row) = sscanf($coord,'%[A-Z]%d');
sscanf($coord,'%[A-Z]%d', $column, $row);
$sortKeys[sprintf('%09d%3s',$row,$column)] = $coord;
}
ksort($sortKeys);
@ -198,7 +198,7 @@ abstract class PHPExcel_CachedObjectStorage_CacheBase {
$col = array('A' => '1A');
$row = array(1);
foreach ($this->getCellList() as $coord) {
list($c,$r) = sscanf($coord,'%[A-Z]%d');
sscanf($coord,'%[A-Z]%d', $c, $r);
$row[$r] = $r;
$col[$c] = strlen($c).$c;
}
@ -221,13 +221,13 @@ abstract class PHPExcel_CachedObjectStorage_CacheBase {
public function getCurrentColumn()
{
list($column,$row) = sscanf($this->_currentObjectID, '%[A-Z]%d');
sscanf($this->_currentObjectID, '%[A-Z]%d', $column, $row);
return $column;
}
public function getCurrentRow()
{
list($column,$row) = sscanf($this->_currentObjectID, '%[A-Z]%d');
sscanf($this->_currentObjectID, '%[A-Z]%d', $column, $row);
return $row;
}

View File

@ -3621,7 +3621,7 @@ class PHPExcel_Calculation {
$pRange = $pSheetName.'!'.$pRange;
if (!isset($aReferences[1])) {
// Single cell in range
list($currentCol,$currentRow) = sscanf($aReferences[0],'%[A-Z]%d');
sscanf($aReferences[0],'%[A-Z]%d', $currentCol, $currentRow);
$cellValue = NULL;
if ($pSheet->cellExists($aReferences[0])) {
$returnValue[$currentRow][$currentCol] = $pSheet->getCell($aReferences[0])->getCalculatedValue($resetLog);
@ -3632,7 +3632,7 @@ class PHPExcel_Calculation {
// Extract cell data for all cells in the range
foreach ($aReferences as $reference) {
// Extract range
list($currentCol,$currentRow) = sscanf($reference,'%[A-Z]%d');
sscanf($reference,'%[A-Z]%d', $currentCol, $currentRow);
$cellValue = NULL;
if ($pSheet->cellExists($reference)) {
$returnValue[$currentRow][$currentCol] = $pSheet->getCell($reference)->getCalculatedValue($resetLog);

View File

@ -822,8 +822,8 @@ class PHPExcel_Cell
// Range...
list($rangeStart, $rangeEnd) = $range;
list($startCol, $startRow) = sscanf($rangeStart,'%[A-Z]%d');
list($endCol, $endRow) = sscanf($rangeEnd,'%[A-Z]%d');
sscanf($rangeStart,'%[A-Z]%d', $startCol, $startRow);
sscanf($rangeEnd,'%[A-Z]%d', $endCol, $endRow);
$endCol++;
// Current data
@ -845,7 +845,7 @@ class PHPExcel_Cell
// Sort the result by column and row
$sortKeys = array();
foreach (array_unique($returnValue) as $coord) {
list($column,$row) = sscanf($coord,'%[A-Z]%d');
sscanf($coord,'%[A-Z]%d', $column, $row);
$sortKeys[sprintf('%3s%09d',$column,$row)] = $coord;
}
ksort($sortKeys);

View File

@ -101,8 +101,8 @@ class PHPExcel_ReferenceHelper
* @return integer
*/
public static function cellSort($a, $b) {
list($ac,$ar) = sscanf($a,'%[A-Z]%d');
list($bc,$br) = sscanf($b,'%[A-Z]%d');
sscanf($a,'%[A-Z]%d', $ac, $ar);
sscanf($b,'%[A-Z]%d', $bc, $br);
if ($ar == $br) {
return strcasecmp(strlen($ac) . $ac, strlen($bc) . $bc);
@ -119,8 +119,8 @@ class PHPExcel_ReferenceHelper
* @return integer
*/
public static function cellReverseSort($a, $b) {
list($ac,$ar) = sscanf($a,'%[A-Z]%d');
list($bc,$br) = sscanf($b,'%[A-Z]%d');
sscanf($a,'%[A-Z]%d', $ac, $ar);
sscanf($b,'%[A-Z]%d', $bc, $br);
if ($ar == $br) {
return 1 - strcasecmp(strlen($ac) . $ac, strlen($bc) . $bc);
@ -549,7 +549,7 @@ class PHPExcel_ReferenceHelper
if ($pNumCols != 0) {
$autoFilterColumns = array_keys($autoFilter->getColumns());
if (count($autoFilterColumns) > 0) {
list($column,$row) = sscanf($pBefore,'%[A-Z]%d');
sscanf($pBefore,'%[A-Z]%d', $column, $row);
$columnIndex = PHPExcel_Cell::columnIndexFromString($column);
list($rangeStart,$rangeEnd) = PHPExcel_Cell::rangeBoundaries($autoFilterRange);
if ($columnIndex <= $rangeEnd[0]) {

View File

@ -725,7 +725,7 @@ class PHPExcel_Worksheet_AutoFilter
// Date based
if ($dynamicRuleType{0} == 'M' || $dynamicRuleType{0} == 'Q') {
// Month or Quarter
list($periodType,$period) = sscanf($dynamicRuleType,'%[A-Z]%d');
sscanf($dynamicRuleType,'%[A-Z]%d', $periodType, $period);
if ($periodType == 'M') {
$ruleValues = array($period);
} else {