PDFsharp & MigraDoc Foundation
http://forum.pdfsharp.com/

How speedup migradoc Rendering?
http://forum.pdfsharp.com/viewtopic.php?f=2&t=4104
Page 1 of 1

Author:  IRlyDunno [ Mon Mar 02, 2020 3:07 pm ]
Post subject:  How speedup migradoc Rendering?

Hello, I have some documents that I am generating that are huge,
Something like all account movements of a company in a given year,.
When I create a pdf for a month the result already creates a table with about 9800 rows and takes about 10-15min to generate, I find this aceptable enough. But now, I'm trying to create a document of all movements in a year, and I don't even know how much data there is in there, but the document is now stuck of the ".RenderDocument" method, and it has been there for about 180min now, and still no pdf was created.

What I want to know now, is if there is anyway to make this faster, decreasing the quality or even using multithreading (I haven't tried multithreading because I saw that its not really supported in migradoc), is there anything I can do?

Author:  Thomas Hoevel [ Mon Mar 02, 2020 3:31 pm ]
Post subject:  Re: How speedup migradoc Rendering?

The usual: faster CPU, more RAM, faster SSD, …

Maybe it helps to have more, but smaller tables. Maybe one table per months instead of one table for the whole year, if that is applicable.

Maybe create RTF and use Word to create the PDF.

Maybe run the code in a profiler and identify the routines in MigraDoc that consume most of the time.

Author:  IRlyDunno [ Mon Mar 02, 2020 3:38 pm ]
Post subject:  Re: How speedup migradoc Rendering?

Thanks for the fast reply.

Thomas Hoevel wrote:
The usual: faster CPU, more RAM, faster SSD, …

this program is being run on a azure server, there isn't really any margin for us to improve the server as of now.

Thomas Hoevel wrote:
Maybe it helps to have more, but smaller tables. Maybe one table per months instead of one table for the whole year, if that is applicable.

This could be achieved, but have you tested this before or is there a reason why more tables would be faster?

Thomas Hoevel wrote:
Maybe create RTF and use Word to create the PDF.

Does this mean that generating rtf is faster than pdf? is it beause migradoc has to turn migradoc objects into pdfsharp object and then draw, and rtf just renders?

Thomas Hoevel wrote:
Maybe run the code in a profiler and identify the routines in MigraDoc that consume most of the time.

From what I can tell on my end the only part that is holding back the program is the RenderDocument method, othern than that are you saying I should profile the migradoc code?.

Author:  Thomas Hoevel [ Mon Mar 02, 2020 3:52 pm ]
Post subject:  Re: How speedup migradoc Rendering?

IRlyDunno wrote:
Does this mean that generating rtf is faster than pdf?
Yes. While creating PDF, MigraDoc will calculate the dimensions of any item in order to make the page layout and the page breaks.
With RTF it just emits the text elements without thinking about dimensions, pages, page breaks, and such.

I don't know how the rendering time for 100,000 rows compares to the rendering time for 10,000 rows.
It'll be factor 10 in the best case, but maybe it is worse than that.
For 10 tables with 10,000 rows each it'll be factor 10.

Author:  IRlyDunno [ Mon Mar 02, 2020 4:03 pm ]
Post subject:  Re: How speedup migradoc Rendering?

Ok then, I'll try this and see if it helps...

I'll update this thread with the result, Thanks.

Page 1 of 1 All times are UTC
Powered by phpBB® Forum Software © phpBB Group
https://www.phpbb.com/