My needs currently with PHPExcel are very basic. Within my web application I want to provide users with an "Export to Excel" option. When selected I just need to extract data from mySQL and save it as Excel or CSV for the user.
The challenge is that in some cases there will be 50,000 rows, possibly more. I am very surprised to see how much memory this takes up and am looking for a solution to minimizing the memory footprint.
I did a lot of research and reading past posts on the topic, and see a lot of talk about using different types of cache. Also the documentation states that using caching instead of memory can reduce the memory footprint by 66%.
However that is not my finding. I am using memory_get_peak_usage() before and after the call to generateReport(). What I find is that using the default of cache_in_memory provides the smallest footprint and fastest time. Using cache_to_discISAM actually takes up 30% MORE memory and ran 38% LONGER. I tried cache_to_sqlite and cache_to_sqlite3 and they gave the same result as cache_in_memory.
I basically went through all caching options, and nothing was faster than cache_in_memory. This is confusing because the docs are very clear that by using the caching options you can reduce the memory and time.
Can someone please explain what may be going on and provide some things that may help me optimize the memory usage, even at the expense of slower processing time? I really don't need to do anything other than write the SQL data set to Excel or CSV and have it save it in that format.
Thank you!
The challenge is that in some cases there will be 50,000 rows, possibly more. I am very surprised to see how much memory this takes up and am looking for a solution to minimizing the memory footprint.
I did a lot of research and reading past posts on the topic, and see a lot of talk about using different types of cache. Also the documentation states that using caching instead of memory can reduce the memory footprint by 66%.
However that is not my finding. I am using memory_get_peak_usage() before and after the call to generateReport(). What I find is that using the default of cache_in_memory provides the smallest footprint and fastest time. Using cache_to_discISAM actually takes up 30% MORE memory and ran 38% LONGER. I tried cache_to_sqlite and cache_to_sqlite3 and they gave the same result as cache_in_memory.
I basically went through all caching options, and nothing was faster than cache_in_memory. This is confusing because the docs are very clear that by using the caching options you can reduce the memory and time.
Can someone please explain what may be going on and provide some things that may help me optimize the memory usage, even at the expense of slower processing time? I really don't need to do anything other than write the SQL data set to Excel or CSV and have it save it in that format.
Thank you!