Skip to content

Commit

Permalink
Use gt operator instead of max for highest row
Browse files Browse the repository at this point in the history
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
  • Loading branch information
Matt Allan authored and PowerKiKi committed Jan 2, 2019
1 parent ff6f4f4 commit 0f8292f
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 1 deletion.
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand Down
4 changes: 3 additions & 1 deletion src/PhpSpreadsheet/Worksheet/Worksheet.php
Original file line number Diff line number Diff line change
Expand Up @@ -1268,7 +1268,9 @@ private function createNewCell($pCoordinate)
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
Expand Down

0 comments on commit 0f8292f

Please sign in to comment.