Appending multiple reports using pdf utils takes more time to render report



  • Hi sir,

    I using jsreport pdf utils for appending 3 reports , that means,
    I have a main template from which I m calling other 3 template in the after render hook.ie,

    In After render hook,

    1.append main template content with template 1
    2.append template 1 content with template 2
    3.append template 2 content with template 3

    Time duration explanation
    1.from before render to after render of main template takes 1 or 2 second
    2.rendering of template 1,2,3 takes 3 or 4 second means report data reading API takes 1 or 2 sec and from beforerender to reach afterrender takes 2 seconds.

    So rendering each template takes approximately 4 seconds so total 3x4 = 12 and from beforerender to reach afterrender of main template takes 2 second

    So total 14 seconds .I'm using jsreport version 3.3.0

    Is there any option to reduce the time.

    Is there any other solution to reduce the time??

    Is copy paste the html of each template into one and calling Api for each report in before render hook is the only solution to overcome this time issue??

    Please reply



  • So rendering each template takes approximately 4 seconds so total 3x4 = 12 and from beforerender to reach afterrender of main template takes 2 second

    Why do you render those templates one by one, why don't you render them in parallel using Promise.all or something like that? Note in this case it's better to increase the chrome workers to the number of templates you render inside the script. https://jsreport.net/learn/chrome-pdf#chrome-process-allocation



  • yes i have used promise.all now it renders 9 sec .where i have to put workers,
    {
    "chrome": {
    "numberOfWorkers": 3
    }
    }

    in jsreport configuration or report request object??

    here no of workers is 13 but still it takes time why?



  • here no of workers is 13 but still it takes time why?

    See the description of workers.numberOfWorkers in the docs
    https://jsreport.net/learn/configuration#workers

    The chrome.numberOfWorkers should be in the root of the config.



  • 0_1689009895832_upload-33c93184-407c-4dd3-8b68-2a2047ba400b

    i have changes noofWorkers confiig root name as chrome still time is taking

    "chrome": {
    "numberOfWorkers": 13
    },



  • There is no other way to speed it up.
    If you split one template into 3. jsreport needs to do the whole pipeline 3x. Chrome also needs to parse scripts, build DOM and print pdf 3 times so of course it will be slower than if you do all of this just once.


Log in to reply
 

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