PDF report very very slow



  • Hi,
    I notice that creation of pdf template report is very slow. With same data an excel template is very very faster. Here some benchmarks:

    For a report with about 4k rows:

    2018-02-09 08:56:27,128 [12] INFO - Start creating report with jsreport
    2018-02-09 08:56:32,744 [12] INFO - Report created

    => EXCEL 5 seconds

    2018-02-09 08:56:39,533 [9] INFO - Start creating report with jsreport
    2018-02-09 08:57:46,586 [9] INFO - Report created

    => PDF over a minute

    There's some issue about this bad performance?

    I use handlebars with phantom-pdf.

    Thanks.



  • Can you share the report from benchmark in the playground? Thank you
    https://playground.jsreport.net/



  • You can find slow-pdf report.

    thanks.





  • I've tried both on my pc and on the server. It take the same time. For a report with about 100 pages it take over a minute.

    It's not a problem of a single pdf report but all the pdf reports I've create have this issue. Very very slowly than the relative excel extraction.



  • We will try it out with different recipes and without some styles....

    However you cannot compare pdf and excel performance. That is something completely different.



  • Yes i know but for a web-consumer export a simple report (some dozens of pages) in some minutes is an infinite time to wait.



  • Hi! just passing by and looking into it, but could it be possible that nesting <table></table>have an impact on performance ?
    I did try to isolate each table and could generate the report (without keeping the css style thought) within arround <15 sec, for 128 pages in total against 346 pages in > 45 sec using wkhtmltopdf recipe as all the other timed out for me.

    Hope this can help finding solution :)



  • Yes, by removing the css file, and the reference, the creation pass from over a minute to 19 seconds.

    Perhaps there's a problem using css file to style the report.


  • administrators

    Yes i know but for a web-consumer export a simple report (some dozens of pages) in some minutes is an infinite time to wait.

    @nbiadene yes, we understand that but as you probably know we can only improve things that we can actually improve and have in control. for this case Phantom is just being slow with nested tables and lot of rows + css styles, unfortunately we can't solve the speed problem of Phantomjs because it is part of the engine itself (an engine outside of jsreport source code), the actual evaluation that we do is not the bottleneck here, so we can do nothing about it. however keep reading bellow for a good alternative.

    Hi! just passing by and looking into it, but could it be possible that nesting <table></table>have an impact on performance ?
    I did try to isolate each table and could generate the report (without keeping the css style thought) within arround <15 sec, for 128 pages in total against 346 pages in > 45 sec using wkhtmltopdf recipe as all the other timed out for me.

    thanks @MI53RE19 for the good idea, it helped us to keep testing the case and finally find a root cause (at least in Chrome, in Phantom there is no way to improve it for this case)

    Yes, by removing the css file, and the reference, the creation pass from over a minute to 19 seconds.
    Perhaps there's a problem using css file to style the report.

    yes, the problem is just that Phantom is just slow when styling a lot of rows. however as we realized that we can not improve this case by just using the phantom recipe then we tried to use the chrome recipe and compare the performance between the two. at first, we saw the chrome was not able to even finishing the rendering of this report and always ended in a timeout, we tried some things and found that chrome has a weird bug when rendering a table with a lot of rows and when the html source of table has some identantion levels inside it. for example, check this example, you will see that it never finish and it will just timeout in the end, now check this example with the same source but with the indentation level formatted, you will see how it can render it and much faster than phantomjs.

    @nbiadene so in the end we modified your original template to use chrome recipe and updated some indentation to workaround the chrome bug and. the result was that your report renders in 13-15s with all the styles (not sure if removing the nested table will improve the case even more but you can try that if you want). here is the same template but with chrome if you want to make a test.

    so we recommend you to try chrome recipe which seems that it can work better for your case.


  • administrators


Log in to reply
 

Looks like your connection to jsreport forum was lost, please wait while we try to reconnect.