Increasing performance of an Excel import feature
Jorge Luis Betancourt, PHP dev at University of Informatic Sciences and Apache Nutch PMC Member, figured with the help of Blackfire that switching his Excel parsing library could reduce his memory usage by 60 times and his execution time by 12,5 times!
Jorge (@jorgelbgm) is involved in many PHP activities, and a Project Management Committee Member for Apache Nutch.
One of his activities involved working on a Symfony2 application for a customer, supposed to import Excel files. The size of those files was rather small at the beginning, but quickly grew to 5Mb. Soon, he realized that the application wasn’t able to handle such files anymore.
Using Blackfire, Jorge figured that the library choice which was made at the start of the project couldn’t fit anymore. Selecting a new one, he used Blackfire again to tweak it and get an optimal configuration for his specific use case.
Performance with the old library:
Wall Time 2min 47s
CPU Time 2min 46s
I/O Time 946ms
Memory 1GB (!!)
Performance with the new, tweaked library:
Wall Time 13.3s
CPU Time 13.2s
I/O Time 124ms
Memory 16.9MB (!!!)
In such a context, numbers quickly get tremendous proportions. In percentage, that represents an astounding improvement of 92% less time, and 98,3% less memory usage!
Jorge wrote an article detailing his research during the #FireUpMyMac contest, which you can read in full here.