Skip to content

Commit 5b4b12f

Browse files
Skip inner loops for empty/default read filter (#2223)
The optimization from #773 was not copied along in #1033, so restore it Co-authored-by: Adrien Crivelli <[email protected]>
1 parent e550528 commit 5b4b12f

File tree

2 files changed

+6
-0
lines changed

2 files changed

+6
-0
lines changed

CHANGELOG.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -144,6 +144,7 @@ and this project adheres to [Semantic Versioning](https://semver.org).
144144
- Column width and Row height styles in the Html Reader when the value includes a unit of measure. [Issue #2145](https://github.com/PHPOffice/PhpSpreadsheet/issues/2145).
145145
- Data Validation flags not set correctly when reading XLSX files. [Issue #2224](https://github.com/PHPOffice/PhpSpreadsheet/issues/2224) [PR #2225](https://github.com/PHPOffice/PhpSpreadsheet/pull/2225)
146146
- Reading XLSX files without styles.xml throws an exception. [Issue #2246](https://github.com/PHPOffice/PhpSpreadsheet/issues/2246)
147+
- Improve XLSX parsing speed if no readFilter is applied (again) - [#772](https://github.com/PHPOffice/PhpSpreadsheet/issues/772)
147148

148149
## 1.18.0 - 2021-05-31
149150

src/PhpSpreadsheet/Reader/Xlsx/ColumnAndRowAttributes.php

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@
33
namespace PhpOffice\PhpSpreadsheet\Reader\Xlsx;
44

55
use PhpOffice\PhpSpreadsheet\Cell\Coordinate;
6+
use PhpOffice\PhpSpreadsheet\Reader\DefaultReadFilter;
67
use PhpOffice\PhpSpreadsheet\Reader\IReadFilter;
78
use PhpOffice\PhpSpreadsheet\Worksheet\Worksheet;
89
use SimpleXMLElement;
@@ -91,6 +92,10 @@ public function load(?IReadFilter $readFilter = null, $readDataOnly = false): vo
9192
$rowsAttributes = $this->readRowAttributes($this->worksheetXml->sheetData->row, $readDataOnly);
9293
}
9394

95+
if ($readFilter !== null && get_class($readFilter) === DefaultReadFilter::class) {
96+
$readFilter = null;
97+
}
98+
9499
// set columns/rows attributes
95100
$columnsAttributesAreSet = [];
96101
foreach ($columnsAttributes as $columnCoordinate => $columnAttributes) {

0 commit comments

Comments
 (0)