pdfrx may be slow in some cases
Closed this issue · 1 comments
I found that in some cases, pdfrx's speed of loading page images would be slower.
For example:
- Trying to open a large PDF file, let's call it PDF A.
- Opening a regular PDF file, let's call it PDF B.
- Attempting to render a page from PDF B.
In this scenario, rendering the page from PDF B is slower than usual, especially after having tried to open the larger PDF A. Only after PDF A has finished loading, PDF B will start to load.
I found that pdfrx uses a BackgroundWorker
internally to handle all tasks, which is essentially a single-threaded worker that handle asynchronous behavior.
Can we change this situation, for example, using a separate BackgroundWorker
for each PDFDocument
?
1.0.58 fixed concurrency issues caused by misunderstanding of pdfium threading model.
And the fix synchronizes all the pdfium API calls even if they are not for the same PDF document.
In your case, PDF A loading process blocks loading of PDF B loading. The loading of the documents does not run concurrently.
It's a pdfium limitation. Not a pdfrx limitation.
We should consider some kind of out of process PDF loading model but it's too complex and not easily realized.