Conversation
|
👋 @kean, would you be able to give me your thoughts on this as a follow-up to #20956 (comment)? The main thing I'm not sure about is what the value of the cache cost calculation that |
|
| App Name | WordPress Alpha |
|
| Configuration | Release-Alpha | |
| Build Number | pr21285-9d83e7f | |
| Version | 23.7 | |
| Bundle ID | org.wordpress.alpha | |
| Commit | 9d83e7f | |
| App Center Build | WPiOS - One-Offs #7888 |
|
| App Name | Jetpack Alpha |
|
| Configuration | Release-Alpha | |
| Build Number | pr21285-9d83e7f | |
| Version | 23.7 | |
| Bundle ID | com.jetpack.alpha | |
| Commit | 9d83e7f | |
| App Center Build | jetpack-installable-builds #6912 |
|
@guarani I'd suggest going with option B and reimplementing the SDWebImage version: UIImage+MemoryCacheCost.m.
If you don't pass the cost, it'll be 0 (only documented in the headers): - (void)setObject:(ObjectType)obj forKey:(KeyType)key; // 0 costThe cost must be non-zero in order for the
SDWebImage also handles it, but we are not using |
This proposes replaces usage of `SDWebImage` in the new `MemoryCache` following the comment #20956 (comment). It's only being used in one instance, to calculate the cost of objects added to the cache. What's the difference between not passing in a cost and using `sd_memoryCost`? I'm not sure, so I'll share my current understanding and ask for feedback. For images, I don't see a difference because I think the cost is the image's size in bytes. For gifs (also `UIImage`s), the cost calculation seems more complex since I think it's only the number of frames loaded into memory (not the frames that are kept on disk). This PR is meant to start a conversation about which option to take: a. Let `NSCache` calculate the cost and remove `SDWebImage` from the Podfile b. Re-implement a cost calculation and remove `SDWebImage` from the Podfile c. Leave things as-is and close this PR The assumption here is that by removing `SDWebImage`, we're not importing the library twice (once here and once in Gutenberg as a transitive dependency of a RN library).
28ad671 to
5156b31
Compare
|
I rebased it and updated cost calculation – ready for merge. |
f8d3254 to
9d83e7f
Compare
Generated by 🚫 Danger |
|
Thanks @kean! |


This proposes replaces usage of
SDWebImagein the newMemoryCachefollowing the comment #20956 (comment). It's only being used in one instance, to calculate the cost of objects added to the cache.What's the difference between not passing in a cost and using
sd_memoryCost? I'm not sure, so I'll share my current understanding and ask for feedback. For images, I don't see a difference because I think the cost is the image's size in bytes. For gifs (alsoUIImages), the cost calculation seems more complex since I think it's only the number of frames loaded into memory (not the frames that are kept on disk).This PR is meant to start a conversation about which option to take: a. Let
NSCachecalculate the cost and removeSDWebImagefrom the Podfile b. Re-implement a cost calculation and removeSDWebImagefrom the Podfile c. Leave things as-is and close this PRThe assumption here is that by removing
SDWebImage, we're not importing the library twice (once here and once in Gutenberg as a transitive dependency of a RN library).To test: TO-DO
Regression Notes
PR submission checklist:
RELEASE-NOTES.txtif necessary.UI Changes testing checklist: