-
Notifications
You must be signed in to change notification settings - Fork 30
Description
Should we cache image sources?
Related discussion:
#497 (comment)
Lightning 3 prior versions to 2.9.x will cache image source data in JS and only clear GPU Textures when a memory limit is reached. The thinking process is we could clear image source data knowing the browser would cache the image in its network layers. However there is no reliable way to determine whether this is the case or not.
The risk is that if this is not properly cached in the lower browser layers it would introduce additional delays in loading images as we would need to fetch the entire image source again.
By keeping this in JS this guaranteed the image source is always readily available at the cost of JS HEAP usage.
Options:
- Make the option to cache image source data configurable, so we can turn it on for devices that might have issues with caching images at the lower layers
- Introduce a Image Source cache mechanism that will cache images up to a predefined Mb limit, before it starts pruning sources to more granular control the HEAP allocations for image source data
Also I've half-assumed this is what L2 does as well, based on a vague recollection of how the source data processing works in L2. If someone knows please speak up or otherwise I'll go down a trip of peeking at L2 code again.
Suggestions/ideas are welcome 😃