PHPPdf icon indicating copy to clipboard operation
PHPPdf copied to clipboard

Long table, slow render

Open amcastror opened this issue 11 years ago • 12 comments

Hi,

I'm rendering a table with 250 lines, using a tag, but it takes enough time to exceed allowed execution time. The issue is that rendering the information of the table without the html tags (table, tr and td) takes 10 times less time than rendering the hole thing. The result (with tags) is a 14 page pdf.

The problem is solved if I use a tag and break the page myself, but this doesn't really work for me.

The cache is turn on by the way.

Any ideas? Thanks a lot!

amcastror avatar Aug 29 '14 17:08 amcastror

Please show your code.

aledeg avatar Aug 29 '14 17:08 aledeg

I have a project with huge tables. My max_execution_time is 30 seconds and I can render tables with almost 1000 lines. I hit a different problem with tables with more than 20000. It is not a timeout but a memory problem.

aledeg avatar Aug 29 '14 18:08 aledeg

I'm having some issues with execution time too. Can't render a table with more than 200 lines. What's your aproach to render a 2000 lines report, do you render many files and then concat them?

franciscotfmc avatar Oct 06 '14 17:10 franciscotfmc

I found out that using "page" instead of "dynamic-page" did render the view, but you need to estimate when to insert a new block (page break). It's not the best solution, but it works for now. ᐧ

Saludos,

On Mon, Oct 6, 2014 at 2:12 PM, Francisco [email protected] wrote:

I'm having some issues with execution time too. Can't render a table with more than 200 lines. What's your aproach to render a 2000 lines report, do you render many files and then concat them?

— Reply to this email directly or view it on GitHub https://github.com/psliwa/PHPPdf/issues/67#issuecomment-58051851.

amcastror avatar Oct 06 '14 18:10 amcastror

Thank you amcastror, I'm gonna try that now. The cons of this page tag is that the pagination won't work out of the box, I guess. But if it renders the 2000 lines, it will worth the loss.

franciscotfmc avatar Oct 06 '14 18:10 franciscotfmc

Glad it helped. If I find a better approach I'll post it here. Good luck. ᐧ

Saludos,

On Mon, Oct 6, 2014 at 3:40 PM, Francisco [email protected] wrote:

Thank you amcastror, I'm gonna try that now. The cons of this page tag is that the pagination won't work out of the box, I guess. But if it renders the 2000 lines, it will worth the loss.

— Reply to this email directly or view it on GitHub https://github.com/psliwa/PHPPdf/issues/67#issuecomment-58069472.

amcastror avatar Oct 06 '14 18:10 amcastror

@aledeg What did you do with the memory problem? I think I'm having the same problem now. The more "divs" I use, higher is the probability of a PHP fatal error, trying to allocate more memory than it's allowed.

Thanks in advance

franciscotfmc avatar Oct 07 '14 20:10 franciscotfmc

I will look closer to this issue and try to optimize table support algorithm, but I can not tell when you can expect the results.

psliwa avatar Oct 07 '14 20:10 psliwa

In fact, I'm not using table anymore. Just a bundle of divs with float left and right. I think I'll have to split the generated files in more than one.

franciscotfmc avatar Oct 07 '14 21:10 franciscotfmc

@franciscotfmc I did nothing. I need to solve that problem too. But as it occurs no so often, it is not critical. FYI it happens only once in the past year

aledeg avatar Oct 08 '14 12:10 aledeg

Hello guys,

Just FYI, the timeout issue was solved removing the table tag and maximizing the php time limit to 240. The memory leak I could manage as @amcastror suggested, removing the dynamic-page and manually calculating the paginations, now using he page tag.

Thank you for the help!

franciscotfmc avatar Oct 08 '14 17:10 franciscotfmc

I had this problem and solved it by chunking out the data into groups of 20 (or whatever fits nicely on a page) and created a new table for each set. This also solves having a <thead> section on each page.

Surprisingly this increased performance quite a bit.

noetix avatar Feb 25 '15 09:02 noetix