Large XLSX Reading Benchmark
Reproduce the MNB PHPExcel rows-versus-array reference measurement with the included workbook and standalone CLI benchmark script.
Updated
PHP 8.1+StreamingDownloadable scriptSample workbook
Available sincev2.0.5Version guide
What you will learn
- Run each reading mode in a fresh PHP process.
- Capture median elapsed time, peak allocated memory, rows, file bytes, and environment details.
- Publish results with enough context for another developer to reproduce them.
Download and run the benchmark#
Download benchmark-mnb-read.php
php benchmark-mnb-read.php.txt large-orders.xlsx 9 rows
php benchmark-mnb-read.php.txt large-orders.xlsx 9 arrayReference output#
{
"mode": "rows",
"rows": 500,
"median_ms": 37.512,
"min_ms": 34.944,
"max_ms": 96.031,
"peak_memory_bytes": 18874368,
"php": "8.4.16",
"xmlreader": false,
"zip": false,
"file_bytes": 22629,
"iterations": 9
}{
"mode": "array",
"rows": 500,
"median_ms": 37.298,
"min_ms": 34.786,
"max_ms": 92.141,
"peak_memory_bytes": 18874368,
"php": "8.4.16",
"xmlreader": false,
"zip": false,
"file_bytes": 22629,
"iterations": 9
}Scale the test correctly#
- Generate or obtain 10k, 100k, and 1M-row fixtures rather than extrapolating from 500 rows.
- Run each method in a fresh process because peak memory is process-wide and does not reset.
- Use the same selected columns, header mapping, empty-row option, formulas, styles, and shared-string policy.
- Record cold-cache and warm-cache runs separately.
- Do not compare results across different storage devices, PHP builds, extension sets, or workbooks without saying so.
Was this guide useful?Use GitHub issues for corrections, missing examples, or unclear behavior.
Open an issue