Slow performance in PDFViewer2 component when events fire.

For some reason my PDFViewer2 component is encountering some pretty significant performance issues and I'm not sure why. It seems that whenever an event is fired (mouseUp/mouseDown) there is a significant blocking function call that completely freezes the component for a second or two and then it will continue. 

As you can imagine having the component freeze for seconds at a time any time the user clicks or even moves the mouse button for any reason is pretty unacceptable so I'm trying to figure out why this might be happening. 

This is a screenshot of the performance graph from Chrome after trying to simply move an annotation shape. The function takes 1.34s to fully execute and during that time the entire component is unresponsive. This is just from trying to click/drag an annotation shape to a new position. 

image_4.png


The PDF itself is not large at all. The documents are almost always less than 500kb and only a single page. The content itself is fairly simple as well, usually just an image with a basic pdfgrid containing some data. I create a new PDF using the PdfDocument class, insert an image, a pdfgrid with data, sometimes a hyperlink, and return a base64 string which is used as the DocumentPath for the viewer.

Image_8784_1708457343312

I do increase the page size of the PDF to be an A4 page size but really there isn't anything overly complex happening in my code. 

Is there something simple that I could be missing? Maybe some listeners that aren't being disposed of maybe? 


I'm using Dotnet 8.0.101 and all my Syncfusion package versions are 24.1.45.



6 Replies

SK Sathiyaseelan Kannigaraj Syncfusion Team February 21, 2024 12:56 PM UTC

Hi Dylan Lyon,

We have provided a demo video showcasing the issue not reproduced on Blazor Server sample, along with the sample code below. If feasible, please modify the sample to reproduce the issue.


Please confirm whether you are using the Server component or the WASM component, and specify the browser in which you implemented this project. Additionally, if possible, kindly provide a sample and the steps to replicate the issue. Please also confirm whether you are experiencing this issue in a localhost environment or in a hosting environment.


Sample
: https://www.syncfusion.com/downloads/support/directtrac/general/ze/BlazorServer-699551624.zip

Demo
: https://www.syncfusion.com/downloads/support/directtrac/general/ze/Slowness_in_pdfviewer-2024782291.zip 


Regards,
Sathiyaseelan K



DL Dylan Lyon February 21, 2024 05:11 PM UTC

Hi Sathiyaseelan,


Thank you for the quick response! I'm using Blazor WASM and I'm using the new PDFViewer2 component on client side Blazor. I'm currently using Google Chrome Version 121.0.6167.161. This is happening in my local but its also happening in our deployed web app environment (albeit slightly less severe). 


I recorded a video from a quick sample project I loaded up. It seems to be happening here in the sample project as well. In the video you can see it scrolls smoothly but when I click my mouse it freezes the component and then the scroll bar jumps to its updated position. You can see as well when I draw a box its slow to update and even moving the drawn box is slow as well instead of moving smoothly.


The only code I've added aside from project setup is in the Home.razor and Home.razor.cs. In our full app it exports a base64 image string from a mapping framework and I use that as the basis for a new PDF document. I hardcoded the base64 image strings (normally they're asynchronously supplied through an API client) for ease of sharing. There's some additional business logic code for resizing the image and adding some additional labels and things but for the most part the core purpose is to export that map image and for my own benefit I excluded some of the more complex code so I didn't have to integrate any of the business data. It should still serve to showcase the issue though.


Am I possibly doing something wrong? Maybe increasing the page size throws things off? I won't claim to have the cleanest code of all time but I don't think there is anything I'm doing particularly incorrectly? Than


Attachment: SF_PDFViewer2_Slowdown_f4dd069b.zip


SK Sathiyaseelan Kannigaraj Syncfusion Team February 22, 2024 02:36 PM UTC

Hi Dylan Lyon,

We were able to reproduce the reported issue "Slowness in annotation adding and moving” and suspect this to be a defect. We will analyze further on this and update you with more details on February 26th, 2024. However we didn't face any issue related to delay in scrolling.

Regards,

Sathiyaseelan K



SK Sathiyaseelan Kannigaraj Syncfusion Team February 27, 2024 12:46 PM UTC

Hi  Dylan Lyon,

We have logged this as defect as 
"Slowness in annotation adding and moving" and the fix for the issue will be available in our upcoming weekly NuGet release on March 20, 2024. You can track the status of the issue through the following link.

Feedback link:
Slowness in annotation adding and moving | Issue Feedback

Disclaimer:
 "Inclusion of this solution in the weekly release may change due to other factors including but not limited to QA checks and works reprioritization."


Regards,
Sathiyaseelan K



SK Sathiyaseelan Kannigaraj Syncfusion Team March 20, 2024 01:24 PM UTC

Hi Dylan Lyon,

We don't have the weekly release today since the Volume 1 Main release was rolled-out on this week and the fix was not included in this release. However, the fix for the reported issue will be included in our upcoming weekly NuGet release on March 27, 2024. Appreciate your patience.


Regards,
Sathiyaseelan K



SK Sathiyaseelan Kannigaraj Syncfusion Team March 27, 2024 12:03 PM UTC

Hi Dylan Lyon,

We have fixed the reported issue
"Slowness in annotation adding and moving" and the fix for the reported issue was included in our latest weekly release v25.1.37. Kindly upgrade to that version to get the issue resolved.
 
Root Cause: Unnecessary server calls are being made when interacting with annotations, leading to performance issues and unnecessary data transfer. These calls occur even when there are no changes in annotation properties, such as fill color, stroke color, opacity, font size, font type, or text style. This behavior causes difficulties when moving annotations due to the frequent server requests.

Solution:
To address this issue, we have implemented restrictions on multiple server calls. Now, server calls are triggered only when there are modifications to properties related to annotations. This optimization ensures that server requests are made only when necessary, reducing unnecessary data transfer and improving performance.
 

 
CDN Links:

https://cdn.syncfusion.com/blazor/25.1.37/styles/bootstrap5.css
https://cdn.syncfusion.com/blazor/25.1.37/syncfusion-blazor-pdfviewer.min.js
https://cdn.syncfusion.com/blazor/25.1.37/syncfusion-blazor-sfpdfviewer.min.js 


Regards,
Sathiyaseelan K


Loader.
Up arrow icon