views:

38

answers:

1

Hi there

In my web-application I have some forms and based to those forms, users will generate some excel and chart files(.xls and .png). Each use has to generate at least 2 excel files and 5 png files.

The problem is that when is about to generate those files it takes 2 seconds for a excels file and 1 second for a chart. I'm using the PHPExcel and pcharts libs.

Can you give me some ideas about how to optimize this task?

+1  A: 

Definitely time of generation depends on how many records you are working with.
Let's suppose this number is in small range..

Option 1

1 second for chart generation is ok. For excel files - no.
Possibly PHPExcel library is the one what you may want to replace with your own functions for faster xls file generation. Check out here. I have used functions from that article before and they are working like a charm. Sure, if you need to nicely format your data, you are forced to use PHPExcel and can nothing to do with that.

Option 2

Cache your files server-side.
For example, once you generated chart/xls you can save it to appropriate place, and when user requests later the same chart/xls you are not needed to rebuild it.

Andrejs Cainikovs
Many thx Andrejs. I like both of your options. Who can give me some links about this caching procedure?
dole doug
I doubt you will find copy-paste solution. You need this implement by yourself as this is something very project-specific.
Andrejs Cainikovs