Memory/ performence problems with specyfic pdf files

Hello, I’ comparing the displaying of specific pdf files, on pdf.js express and original pdf.js
output (1).pdf (961.1 KB)

I’m using Google Chrome 111

1) original pdf.js from github

Renders quickly when opened, no blurring, the document shows from top to bottom as you scroll. Scrolling has no effect on document rendering
(63 MB - page + 16MB - worker)

2) PDF.js Viewer Demo | PDF.js Express
After choosing file, nothing is happening a longer time, after that I see blurred doc,
I do zoom to 100%. When I try to scroll up and down I watch memory consumption in peek is increasing
(319 MB - page + 14MB - worker)

If I scroll up and down parts are rendering memory consumption increases and I again see a blurred document, rendering is very slow

When part is rendered memory is like
(130 MB - page + 2MB - worker)

But when I scroll up and down and clik “Remove your File” and then I choose same file from disk
I see white area, longer time nothing is happening

Also I encored a problem after several time viewing and removing files in my application just like on demo, and it looked like memory wasn’t freed, after closing a document, and loading a new one.

In my opinion, the original pdf.js handles such files better, the rendering time is shorter, and the memory consumption is much lower.
What is causing this behavior of pdf.js express? Can I expect any improvement?

Hi there,

Thank you for contacting pdf.js express forums,

For pdf.js express viewer, the pages are rendered only for what is currently in the viewport:

Here is our guide on PDF optimization that may help with the performance of this file:

Best regards,
Kevin Kim