-
-
Notifications
You must be signed in to change notification settings - Fork 127
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Saving note causes freeze for 10-60 seconds depending on the imported pdf's size. #1189
Comments
What is the size of pdf? Number of pages and size on disk. Can you share it? |
Happens on any pdf I tried, ranging from 400 KB to 15 MB. Pages range from 15 to 200. Unfortunately, I'm not allowed to share them as they contain sensitive information about other people, but they are all different pdfs from different sources, some from Libreoffice, some from powerpoint etc. I've also checked the logcat, nothing related there. Also happens on another device with different chipset: Samsung Galaxy A52 |
Happening with any pdf size. |
Just tested it, also happens on Linux flatpak v0.21.2 |
I think that the problem is that during saving note is saved pdf itself. Behavior should be probably changed to not save the pdf itself but only handwriting. This will increase the speed of saving. It needs to rewrite AssetsCache and Save code. I will try to implement it, but it will be quite a big change. |
After fiddling around with the flutter profiler, I found out that OrderedAssetCache.add method is the culprit after commit a95f44b. Unfortunately, I have no previous experience with flutter so it's taking some time for me to wrap my head around some things. |
You are right @atahanacar. Code inserted in commit a95f44b causes slow saving of note. It should be improved. This part of code (suggested by me) avoided saving notes with missing pdf pages, but causes another problem. We should switch to different type of comparison of assets - not byte per byte. Thank you for pointing on this commit. |
I am working on caching the OrderedAssetCache index of the pdf file in AssetCache using the pdfs file path. This should solve the issue of comparing entire pdf byte by byte for every single page. |
Comparison of pdf file byte by byte was implemented because code |
For this reason, I'm adding another check that if a pdf file with the same path is passed to |
Could it be done by importing pdf as converted set of images? |
No, that wouldn't solve any problems and make others worse. Right now, the linked pull request fixes the issue, so we're waiting for it to be merged. For the time being, you can use the previous version I mentioned above, or compile my commit on your own. As for the capabilities not being used, that's not actually true. Converting the pdf to images as a storage medium would mean text would be rendered at a single resolution with no way to adapt to zooming in. Also, I'm planning on adding/requesting features that actually make use of the pdf just like you said. |
Before submitting an issue, please check the following
Describe the bug
When saving a note, the entire app becomes unresponsive until saving is completed.
To reproduce
Expected behavior
The app shouldn't freeze.
Saber version
v0.21.2 F-Droid (21020)
Device
Anything else?
v0.21.1 doesn't have this issue.
The text was updated successfully, but these errors were encountered: