Slow performance of ProcessParagraphs() when document contains images

Calling PdfDocument.ProcessParagraphs before saving is getting exponentially slower as we append content to the document.
The document is not complex, with a couple of images and a few basic, nested tables. I cannot provide the sample code due to the nature of the code, but I don’t think the implementation is the issue.

Once we add a loop in to repeat the content a few times, the execution is taking much longer.

For example, a basic 6 page document with a header image and some nested tables is taking 0.2 seconds to construct and then 2.8s to complete ProcessParagraphs (and then some more to save), on an incredibly high spec machine. I am worried about performance on a client site.

As the Aspose library is closed source I cannot dig in to work out why this is.

Are there any known issues with performance on this method?
What is the expected execution time of this method?
Is there anything we could be doing to increase performance?

Edit I have found that this is related to having images. For some reason having images in the header causes this slow down.

Edit2This seems to be only an issue if you are not specifying the exact H/W of an image, most likely as the code that is working out the image sizing is not optimised

@R_C_D_T

We appreciate your interest and efforts which are helpful to improve the API. For mentioned scenario, would you please share SSCCE code along with necessary files, if any, so that we may proceed to reproduce and investigate it in our environment.

@Farhan.Raza

We are experiencing the same sort of problem. What I’ve noticed so far that an image with a width of 7.5 inches by 3 inches at 400x400dpi takes about 1500ms to process after adding it to the paragraphs collection of a PDF document, while the same image at 72x72dpi takes only 70ms.

The image format also seems to matter. A 400x400dpi JPEG image is many times faster in processing than the same image in PNG format. (The image is generated from an Aspose.Cells chart).

@Drak

Thank you for posting.

Kindly share SSCCE code or sample application along with respective files as ZIP so that we may try to reproduce it with latest version and investigate accordingly.

Hi,

here is a short program demonstrating the issue with PNG files:
SSCCEAsposePDF.zip (13.7 KB)

Output example:
Type: Jpeg at DPI 72, 1 images of 21359 bytes each, took 75 milliseconds to process
Type: Jpeg at DPI 72, 2 images of 21359 bytes each, took 15 milliseconds to process
Type: Jpeg at DPI 72, 3 images of 21359 bytes each, took 10 milliseconds to process
Type: Jpeg at DPI 72, 4 images of 21359 bytes each, took 17 milliseconds to process
Type: Jpeg at DPI 144, 1 images of 52738 bytes each, took 6 milliseconds to process
Type: Jpeg at DPI 144, 2 images of 52738 bytes each, took 20 milliseconds to process
Type: Jpeg at DPI 144, 3 images of 52738 bytes each, took 30 milliseconds to process
Type: Jpeg at DPI 144, 4 images of 52738 bytes each, took 41 milliseconds to process
Type: Jpeg at DPI 288, 1 images of 133013 bytes each, took 20 milliseconds to process
Type: Jpeg at DPI 288, 2 images of 133013 bytes each, took 59 milliseconds to process
Type: Jpeg at DPI 288, 3 images of 133013 bytes each, took 98 milliseconds to process
Type: Jpeg at DPI 288, 4 images of 133013 bytes each, took 133 milliseconds to process
Type: Jpeg at DPI 400, 1 images of 214733 bytes each, took 37 milliseconds to process
Type: Jpeg at DPI 400, 2 images of 214733 bytes each, took 106 milliseconds to process
Type: Jpeg at DPI 400, 3 images of 214733 bytes each, took 171 milliseconds to process
Type: Jpeg at DPI 400, 4 images of 214733 bytes each, took 239 milliseconds to process
Type: Png at DPI 72, 1 images of 9124 bytes each, took 65 milliseconds to process
Type: Png at DPI 72, 2 images of 9124 bytes each, took 124 milliseconds to process
Type: Png at DPI 72, 3 images of 9124 bytes each, took 187 milliseconds to process
Type: Png at DPI 72, 4 images of 9124 bytes each, took 252 milliseconds to process
Type: Png at DPI 144, 1 images of 22827 bytes each, took 244 milliseconds to process
Type: Png at DPI 144, 2 images of 22827 bytes each, took 490 milliseconds to process
Type: Png at DPI 144, 3 images of 22827 bytes each, took 739 milliseconds to process
Type: Png at DPI 144, 4 images of 22827 bytes each, took 984 milliseconds to process
Type: Png at DPI 288, 1 images of 52939 bytes each, took 966 milliseconds to process
Type: Png at DPI 288, 2 images of 52939 bytes each, took 1934 milliseconds to process
Type: Png at DPI 288, 3 images of 52939 bytes each, took 2905 milliseconds to process
Type: Png at DPI 288, 4 images of 52939 bytes each, took 3865 milliseconds to process
Type: Png at DPI 400, 1 images of 81779 bytes each, took 1877 milliseconds to process
Type: Png at DPI 400, 2 images of 81779 bytes each, took 3744 milliseconds to process
Type: Png at DPI 400, 3 images of 81779 bytes each, took 5651 milliseconds to process
Type: Png at DPI 400, 4 images of 81779 bytes each, took 7451 milliseconds to process

@Drak

Thank you for sharing requested data.

We have logged a ticket with ID PDFNET-47107 in our issue management system for further investigation and resolution. The ticket ID has been linked with this thread so that you will receive notification as soon as the ticket is resolved.

We are sorry for the inconvenience.

@Farhan.Raza Any update on this ticket?

@SravanDevarai

We are afraid that the earlier logged ticket has not been yet resolved due to other pending issues in the queue. Nevertheless, your concerns have been recorded and we will surely inform you once we make some certain progress towards its resolution. Please be patient and spare us some time.

We are sorry for the inconvenience.