Repository navigation
Keep decoded transcript images in Coil's memory cache - #144
Merged
Merged
Conversation
DecodedImageCache was a hand-rolled 48 MB LRU ported from iOS, kept next to Coil's memory cache. A Markdown http image was held in both: Coil cached it under its URL and the app cached the same bitmap again under its own key. DecodedImageCache now stores its entries in Coil's shared memory cache (SingletonImageLoader's), keeping its SHA-256 keys and its image/insert API, and a Markdown http image loads through Coil under that same key, so it is held once. The budget, LRU and memory-pressure trim are now Coil's. DecodedImageCacheTests only covered the removed LRU and purge, so it is deleted; the parity row says so. Verified: vm.sh check (full) passes; emulator checks in the PR.
Closed
This branch was previously deployed
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.
DecodedImageCachewas a hand-rolled 48 MB LRU ported from iOS, running next to Coil's memory cache. A Markdown http image was held twice: once by Coil under its URL, and again by the app under its own key.DecodedImageCachenow keeps itsimage/insertAPI and SHA-256 keys but stores entries in Coil's shared memory cache. A Markdown http image loads through Coil under that same key, so it is held once. The LRU, budget and memory-pressure code is deleted.DecodedImageCacheTests, which only covered that code, is deleted too; the parity row says so.These stay as they are:
CachedImage.decoded(synchronous), the viewer's full-size decode, site icons, link-preview artwork and agent image previews. Each relies on things Coil doesn't do without extra code. A custom CoilFetcherfor server images would have added an abstraction and repeated the server'sMarkdownImageCache.Behaviour differences from
devTRIM_MEMORY_RUNNING_LOWCoil halves the cache instead of emptying it.Verified
vm.sh checkpasses.devbuild against this branch:, served from the VM host) behaves the same on both builds, with one GET in the server log for the whole run:devThe
devhttp shot was taken with fresh app data, so its composer has no draft attachment.Not tested