-
-
Notifications
You must be signed in to change notification settings - Fork 1.8k
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
Defer expensive operations until results are read from OCFile #11181
Conversation
Signed-off-by: Dariusz Olszewski <starypatyk@users.noreply.github.com>
APK file: https://www.kaminsky.me/nc-dev/android-artifacts/11181.apk |
master-IT test failed: https://www.kaminsky.me/nc-dev/android-integrationTests/7161-IT-master-20-59 |
blue-Light-Screenshot test failed: https://www.kaminsky.me/nc-dev/android-integrationTests/11181-Screenshot-blue-Light-21-05 |
I wrote it also in the other issue: would it also working to use a real database for this? |
Hey @starypatyk , we've discussed this and, as mentioned by Tobi, we'd rather do the parsing when saving the object to the database (well, actually when getting it from the server would be more correct). This avoids inconsistencies altogether, and it's how it should've been modeled in the first place. To do this we'll need to store the sharees in a separate table with a foreign key to the filelist table. Not entirely sure how that's done in Room, but I think it is possible.
Separate PR would be better. Thanks! |
Starting from the simple one...
I have submitted PR #11227. |
As a short-term solution, I proposed a separate PR #11251. Thinking long-term: fully agree with the idea of having two numeric fields for the image dimensions. Regarding sharees - separating this data into another table seems indeed to be the most elegant solution. I am not sure however, that such approach is going to improve performance. I am quite surprised that JSON decoding takes that much time. As this is purely in-memory operation, I would suspect JSON decoding to be much faster than database retrieval - which involves I/O operations. Making such change would require some careful performance verification, to make sure that it indeed improves performance. BTW - I see some data redundancy between the Closing this PR as no longer relevant. |
As discussed in #10783, this PR is an attempt to defer relatively expensive operations performed during creation of the
OCFile
objects - esp. affecting theFileDataStorageManager::getFolderContent
method.The first part is deferring JSON deserialization of
sharees
andimageDimension
members ofOCFile
.This change gives a modest speed improvement. In my "standard" benchmark (~330 files in a directory on a low-powered device) the average execution time of the
OCFileListFragment::listDirectory
call is reduced from 340 ms to 300 ms.@AlvaroBrey @tobiasKaminsky - Some questions:
OCFile
objects shared between threads? If yes then I should probably add synchronization to the new get/set methods.File.exists
check. Do you think this should be included in this PR or should I submit a separate one?