Thank you for the detailed reply.
My motivation to serialize the PHPExcel Object was the performance when filling the cells and writing the excel file. I tried to chase it down a little bit, especially for filling the cells. I would like to share my experience with you if you don't mind.
It took me round about 5 sec to fill a phpExcel with 5000 rows and 9 cols. I used getCellByColumnAndRow + setValueExplicit, because I had already figured out that setting the value with an explicit type is only half price.
Within getCellByColumnAndRow I found that these 3 function calls are the most costly ones:
- PHPExcel_Cell::stringFromColumnIndex($pColumn) (12ns);
- new PHPExcel_Cell(...) (20ns)
- PHPExcel_Cell::columnIndexFromString($this->_cachedHighestColumn) (15ns)
I was able to reduce the cost of the two static functions to 3ns each by copying their source code into getCellByColumnAndRow directly.
The contructor became a bit faster after removing the strtoupper, not sure if you can renounce that. The rest of the cost seems to come mainly from the _parent assignment. I couldn't really test it, because the workbook just doesn't work any more, when the
cells are not connected to their workbook. Could that be possible? If yes, then it would mean that handling references is very costly in PHP.
Maybe it helps if you want to provide so more performance tuning on PHPExcel. I could share my source code if you are interested.
Best regards, Christian