Avoid JSON deserialization in common trivial cases#11251
Merged
AlvaroBrey merged 2 commits intomasterfrom Jan 17, 2023
Merged
Conversation
This was referenced Jan 14, 2023
Contributor
Author
|
I have looked at the failing tests:
|
Member
Let's rebase the branch to have the tests run again |
Member
|
/rebase |
Signed-off-by: Dariusz Olszewski <[email protected]>
Signed-off-by: Dariusz Olszewski <[email protected]>
1d37170 to
49cccd1
Compare
|
APK file: https://www.kaminsky.me/nc-dev/android-artifacts/11251.apk |
Codecov Report
Additional details and impacted files@@ Coverage Diff @@
## master #11251 +/- ##
============================================
+ Coverage 31.30% 31.38% +0.08%
- Complexity 3351 3368 +17
============================================
Files 566 566
Lines 41584 41586 +2
Branches 5629 5631 +2
============================================
+ Hits 13016 13052 +36
+ Misses 26624 26587 -37
- Partials 1944 1947 +3
|
tobiasKaminsky
approved these changes
Jan 17, 2023
AlvaroBrey
approved these changes
Jan 17, 2023
Member
|
Great idea, @starypatyk ! Many thanks! |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.

This is a very simple approach to reduce time spent on JSON deserialization when reading file data from the local DB - much simpler than originally proposed in #11181.
I have noticed that in my tests, in more than 90% of the cases, the JSON data retrieved from the database is:
"[]""null"The proposed changes handle these common trivial cases without invoking the JSON parser.
With this change and #11227 I have observed that the time spent inside
FileDataStorageManager::createFileInstancemethod is less than 10% of the overall time ofFileDataStorageManager::getFolderContent. Remaining 90% is infileDao.getFolderContent- as expected.