-
-
Notifications
You must be signed in to change notification settings - Fork 69
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
perf: Migrate epub caching system from JSON to Protocol Buffers (#225)
Fixes OOM errors in some cases and enhances the efficiency of caching mechanism, significantly reducing serialization/deserialization times, memory footprint as well as size of cached data on disk. Signed-off-by: starry-shivam <[email protected]>
- Loading branch information
1 parent
5b9b6b9
commit 1ff2526
Showing
8 changed files
with
111 additions
and
46 deletions.
There are no files selected for viewing
This file contains 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
This file contains 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
This file contains 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
This file contains 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
36 changes: 36 additions & 0 deletions
36
app/src/main/java/com/starry/myne/epub/cache/epub_cache.proto
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,36 @@ | ||
// Generated schema file for 'com.starry.myne.epub.models.EpubBook' | ||
// For reference only, not actually used to generate protobuf code | ||
|
||
syntax = "proto2"; | ||
|
||
// serial name 'com.starry.myne.epub.models.EpubBook' | ||
message EpubBook { | ||
required string fileName = 1; | ||
required string title = 2; | ||
required string author = 3; | ||
required string language = 4; | ||
optional Bitmap coverImage = 5; | ||
// WARNING: a default value decoded when value is missing | ||
repeated EpubChapter chapters = 6; | ||
// WARNING: a default value decoded when value is missing | ||
repeated EpubImage images = 7; | ||
} | ||
|
||
// serial name 'Bitmap?' | ||
message Bitmap { | ||
required bytes bytes = 1; | ||
} | ||
|
||
// serial name 'com.starry.myne.epub.models.EpubChapter' | ||
message EpubChapter { | ||
required string chapterId = 1; | ||
required string absPath = 2; | ||
required string title = 3; | ||
required string body = 4; | ||
} | ||
|
||
// serial name 'com.starry.myne.epub.models.EpubImage' | ||
message EpubImage { | ||
required string absPath = 1; | ||
required bytes image = 2; | ||
} |
This file contains 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
This file contains 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
This file contains 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