papermerge-core
papermerge-core copied to clipboard
A 50-page pdf file is very slow to open
A 50-page pdf file is very slow to open, and it takes 10 minutes to open it all. What is the reason?
Good one. I need to optimize. I cannot answer yet why it is slow, need to investigate. In any case, thank you for heads up!
This one is tricky. In short, the problem is that Backend REST API server (i.e. Django application) is serving dynamic files ( i.e. files for each individual page). It would be more efficient to off load serving of the dynamic files to another, specialized service (e.g. nginx).
In your case, when you open a document with 50 pages, and each page is say 1 MB (or maybe 500k ?) and Backend (application) is trying to serve all those files at once. If you combine with the fact that each page preview is also generated at that moment + maybe there is some OCR in background, then there may be no wonder that it is slow.
So far, I did not give much thought to optimizations and I am sure I will find many ways to speed up this part.