Yes, PHPExcel is memory hungry; and because it's written in PHP rather than (for example) C or C++ like many of the PHP modules, it's slower than compiled code would be.
File size isn't a good measure for workbook files when working with PHPExcel. The number of rows and columns (ie cells) is more important. You might also say that your worksheet has no formatting, but that isn't strictly true: Excel applies a default formatting
to all cells, so it is there.
The PHPExcel code itself has a footprint of between 10 and 25MB, depending on which components are being accessed.
At present, each cell in a workbook takes on average 1k of memory (without any caching) or 1.6k on 64-bit PHP - I'll assume 32-bit PHP for the moment - so (for example) a worksheet of 8000 lines with 31 columns (248,000 cells) will be about 242MB. With cell
cacheing (such as php://temp or DiskISAM), that can be reduced to about a third, so the 8000 lines by 31 columns will require about 80MB.
As a typical rule of thumb, I'll double that value if you need to write the workbook as well, so that 80MB would become 160MB, plus the code footprint of 10-25M... giving an expected memory requirement of 185MB.
There are a number of options available to help you reduce the memory usage:
Cell caching reduces memory usage, but at a cost in speed?
$cacheMethod = PHPExcel_CachedObjectStorageFactory:: cache_to_phpTemp;
$cacheSettings = array( ' memoryCacheSize ' => '8MB');
$objReader = PHPExcel_IOFactory::createReader('Excel2007');
$objPHPExcel = $objReader->load("test.xlsx");
Additionally, there are a host of other techniques for reducing memory usage described in
A lot of factors can affect speed of execution. I've created a simple Excel5 workbook with a single worksheet comprising 32769 rows and 17 columns (total 557073 cells, and a file size of 28MB) and run some tests:
Total time to read the workbook was 491 seconds, and Peak memory usage was 731.75 MB (no caching, and full workbook read)
Total time to read the workbook was 469 seconds, and Peak memory usage was 718 MB (no caching, but with ReadDataOnly set to true)
Total time to read the workbook was 802 seconds, and Peak memory usage was 319.75 MB (with phpTemp caching using a 32MB memory cache, and full workbook read)
Total time to read the workbook was 840 seconds, and Peak memory usage was 290.25 MB (with phpTemp caching using a 32MB memory cache, and with ReadDataOnly set to true)
Admittedly, this is on a heavily loaded server, with a slower processor and only 2GB memory. However, it gives a general feel for the effects of using cell caching and/or ReadDataOnly.
Believe me: if I could figure out a way of loading workbooks more quickly, and of using less memory, it would already be implemented