Use gt operator instead of max for highest row

Using an operator is significantly faster than calling the max function.
As this method is called more than once per cell the difference adds up.

Closes #824
This commit is contained in:
Matt Allan 2018-12-18 12:59:19 -05:00 committed by Adrien Crivelli
parent ff6f4f4ec0
commit 0f8292fc0b
No known key found for this signature in database
GPG Key ID: B182FD79DC6DE92E
2 changed files with 4 additions and 1 deletions

View File

@ -22,6 +22,7 @@ and this project adheres to [Semantic Versioning](https://semver.org).
- Change `libxml_disable_entity_loader()` as shortly as possible - [#819](https://github.com/PHPOffice/PhpSpreadsheet/pull/819)
- Improved memory usage and performance when loading large spreadsheets - [#822](https://github.com/PHPOffice/PhpSpreadsheet/pull/822)
- Improved performance when loading large spreadsheets - [#825](https://github.com/PHPOffice/PhpSpreadsheet/pull/825)
- Improved performance when loading large spreadsheets - [#824](https://github.com/PHPOffice/PhpSpreadsheet/pull/824)
## [1.5.2] - 2018-11-25

View File

@ -1268,7 +1268,9 @@ class Worksheet implements IComparable
if (Coordinate::columnIndexFromString($this->cachedHighestColumn) < Coordinate::columnIndexFromString($aCoordinates[0])) {
$this->cachedHighestColumn = $aCoordinates[0];
}
$this->cachedHighestRow = max($this->cachedHighestRow, $aCoordinates[1]);
if ($aCoordinates[1] > $this->cachedHighestRow) {
$this->cachedHighestRow = $aCoordinates[1];
}
// Cell needs appropriate xfIndex from dimensions records
// but don't create dimension records if they don't already exist