PHPOffice/PHPExcel — pull request #103 by amironov (2012-12-03 20:26:58+00:00)
Title: Inline xfIndexes search in PHPExcel_Style::applyFromArray()

Calculate hashes of styles for _cellXfCollection only once.

Use of cellXfExists() in [applyFromArray()](https://github.com/PHPOffice/PHPExcel/blob/91de8c54e491100c161b0bc188712edd51695f83/Classes/PHPExcel/Style.php#L405) is bad idea. Every cloned new style in applyFromArray() is new object and will always be added to styles collection.

[Examples][cellXfExists]$ php 41applyFromArray.php
...
20:02:22 applyFromArray styles (begin)
20:02:22 _cellXfCollection count before: 1
20:02:22 _cellXfCollection count after size styles: 101
20:02:23 _cellXfCollection count after new style: **1101**
20:02:23 applyFromArray styles (end), time: **0.42 s**
20:02:23 Write to Excel2007 format
20:02:23 File written to 41applyFromArray.xlsx
20:02:23 Peak memory usage: **13.75 MB**
...

[Examples][getCellXfByHashCode]$ php 41applyFromArray.php
...
20:02:37 applyFromArray styles (begin)
20:02:37 _cellXfCollection count before: 1
20:02:37 _cellXfCollection count after size styles: 10
20:02:37 _cellXfCollection count after new style: **11**
20:02:37 applyFromArray styles (end), time: **0.19 s**
20:02:37 Write to Excel2007 format
20:02:38 File written to 41applyFromArray.xlsx
20:02:38 Peak memory usage: **3.25 MB**
...

[Examples][inline-search]$ php 41applyFromArray.php
...
20:03:02 applyFromArray styles (begin)
20:03:02 _cellXfCollection count before: 1
20:03:03 _cellXfCollection count after size styles: 10
20:03:03 _cellXfCollection count after new style: **11**
20:03:03 applyFromArray styles (end), time: **0.14 s**
20:03:03 Write to Excel2007 format
20:03:03 File written to 41applyFromArray.xlsx
20:03:03 Peak memory usage: **3.25 MB**
...