-
Notifications
You must be signed in to change notification settings - Fork 1.8k
rendering noticeably slower in the "Printing pages" phase #1510
Comments
Can you share some information:
|
Thank you for your time. Here are the details you asked for:
Built with:
phantomjs Results:
wkhtmltopdf Results:
|
Hmm, I don't really have access to a Mac OS X system -- I'll try to see if I'm able to get the same results on Windows. |
Ok, there is a noticeable pause in the "Printing pages" phase. That only happens for some pages, though -- I suspect that it is something to do with complex pages. |
I thought at first it had something to do with 'page-break-inside' support, since that's the one big difference for my own use. I just removed it and timing didn't change for wkhtmltopdf. Both wkhtmltopdf and phantomjs are using Qt for rendering? And both are using webkit? This is a strange one. |
PhantomJS has pretty much the same patched QT/WebKit that is used by wkhtmltopdf. If you apply the table printing patch in |
Thanks for your efforts. I'm glad to see you got it reproduced. Hopefully some clever profiling and comparison will turn up some clues. |
@ashkulz Any of progress on this? We are experiencing the same slow down. |
@sontek: not really. I did find that it took the extra time in the webkit engine itself, but I didn't get time to figure out what the cause was. |
@ashkulz Our major slowdown right now is with rounded corners. I need to generate a smaller test sample for you, but we disabled border-radius in our CSS and got a 30 second speed up |
@sontek: How much time does it take now -- also, is the timing now comparable to PhantomJS? |
@sontek: Great call! I commented out |
I don't know why |
@ashkulz When will the Qt5 upgrade be done? We had to go back to phantomjs because of another slow issue (outside of the rounded corners). I would love to test to see if the Qt5 upgrade fixes our problems. |
There is no time-frame for when it will happen (i.e. it will get done when it gets done), but I can assure you that it won't happen for a few months at least. |
There is not only a problem with border-radius. I have also a slowdown with gradients. And only one second with this 2 lines (and the pdf file generated is smaller and faster to load with acrobat): The following lines are slow again : It is quite hard to understand why it is slow or not. |
There was a link to a blog post regarding this in the mailing list -- it is an issue in the browser engine itself. You may want to try and see if it is better with |
Thanks, the version 0.13 alpha is really faster. But unfortunalely there is some problems with colors (color inversion) and the --zoom option doesn't work : |
I faced the same problem, but the performance increased not only when removing the border-radius but also by removing the background-color or border-style while keeping the border-radius. The size of the PDF with all the style is very much higher (almost 10 times) when compared to the PDF generated after removing any one of the above styles. I have also found there were images in the PDF when all these properties where there, and no images if any of those properties were removed. The images contain the background color of the two divs separately. The number of such images increases with the number of pages in the PDF. I used pdfimages command.
I tried in Ubuntu14.10 with wkhtmltopdf version 12.2.1 |
Found this same behaviour with the following css, as well in Fedora & OSX with 0.12.1 & 0.12.2.1. Also it spiked the CPU to 100%.
just removing these styles make the process went through fast & smooth 👍 |
@san983 check with --dpi option with value as 72. |
@san983, I think the culprit is most likely to be I'd be interested to hear how you get on with the |
You're right in that it was the DPI setting causing problems for me too. 72dpi did the trick in the end. I'm going to see if |
Just a note that might help others. After this commit our PDF creation ceased to function resulting in empty PDFs (no exceptions) on some systems (a test machine using Ubuntu and a developer machine with Linux mint, but worked on another developers Linux Mint). We are using wkhtmltopdf 0.12.1. I finally traced this back to the dpi defaulting to 72. Raising it to say 100 made it work. Best regard, |
Hi Thomas. Thanks for letting everyone know. If you have the time and inclination it'd be really good to know what the differences in the environments were. Were you using prebuilt packages in each? |
Hi Brendon. I've done some more digging and it seems this issue is related to this ticket (don't mind the windows stuff, the issue also found on linux): #1863 I haven't found a way to test/print the qt_defaultdpi value, but setting dpi in wicked_pdf to 75 (supposed to be default on Ubuntu/Mint) made it work with wkhtmltopdf 0.12.1 and wicked_pdf 1.0.2. Setting dpi below (74 or the 72 default in wicked_pdf 1.0.2) re-introduced the breakage. This seems to confirm that my qt default dpi is 75 and the issue seen by me is the same as reported in the github link. Cheers, |
Thanks Thomas, that's quite interesting. I'll let David know and see what he wants to do with a default in light of this :) |
CSS Radius was causing 95% of my render time. I have a relatively simple html page (400 lines of code, half css, a few tables, and one small logo image). It was taking 6+ seconds per page to render the pdf (which resulted in two pdf pages because of a purposeful break i added). I tried a bunch of things and nothing made a difference until i removed a couple radii in my css. Processing dropped from six seconds to <0.5sec. examples: |
@tbrianjones, take a look at what resolution your documents are rendering at too. This makes a difference along with the radius. I guess there's a bug in the routine that draws the curves, and at high resolution it takes ages. |
I'm not sure whether my colleageus have this exact same issue, but we have a number of Macs that take more than ten seconds to render even the simples HTML files. One other Mac with the same hardware and software renders it in less than one second. Using dtrace we've discoved that the slow Macs do ten times as much calls to You can test it yourself using: |
We've solved it already by removing all custom fonts. Rendering speeds went from 10 seconds to 1 second. Hope this helps somebody. |
@frenkel what version of wkhtmltopdf do u have on your Mac? |
They use 0.12.3, because 0.12.4 has a regression. |
Watermark text with a 0.5 opacity across each page took my processing time from 0.7 seconds to 47.5 seconds, and the size of the document from 180kb to 2.2MB. |
wkhtmltopdf is doing a much much better job at handling page breaks than PhantomJS (Qt4.8.4)... There's no doubt about that. What I've found though is that wkhtmltopdf is running much more slowly than PhantomJS.
On a single test here PhantomJS is rendering a 2 ½ page PDF in less than 4 seconds, while wkhtmltopdf is up at almost 14 seconds.
I'm wondering if there's some sort of debug flag or something that may be slowing things down. Or maybe the page-break algorithm just more computationally expensive?
The text was updated successfully, but these errors were encountered: