RESOLVED INVALID 249915
Don't update MemoryCache during drawImage if the image is decoded into DiscardableMemory
https://bugs.webkit.org/show_bug.cgi?id=249915
Summary Don't update MemoryCache during drawImage if the image is decoded into Discar...
Ahmad Saleem
Reported 2022-12-27 17:51:34 PST
Hi Team, While going through Blink commit, I came across following performance optimization done for improving Canvas benchmarks on mobile devices. Blink Commit - https://chromium.googlesource.com/chromium/blink/+/53145cb436d6033ee2c3d0d1974ba719642c320f WebKit GitHub Source - https://github.com/WebKit/WebKit/blob/55b3d145b200da84bc53e06eb13832850e0579c0/Source/WebCore/loader/cache/CachedImage.cpp#L655 I am not sure whether we need this or not but I just wanted to raise this for discussion purposes whether we can use something similar to get from this commit for any future optimisation. For discussion only. Thanks!
Attachments
Radar WebKit Bug Importer
Comment 1 2023-01-03 17:52:17 PST
Darin Adler
Comment 2 2023-01-30 15:10:57 PST
Is "discardable memory" a concept we have in WebKit too?
Ahmad Saleem
Comment 3 2023-01-30 15:13:53 PST
(In reply to Darin Adler from comment #2) > Is "discardable memory" a concept we have in WebKit too? Searching "DiscardableMemory" in GitHub does not show anything and I tried this on Local branch few days back and tried some Canvas benchmark but it does not seems to increase fps. My testing could be flawed and might not be targeting right benchmarks (I was just googling and opening StackOverflow benchmark mentioning Webkit being slow on Canvas) but this is what I have tried so far with my local testing etc. I don't know how much helpful it would be. Sorry, if it isn't much.
Alexey Proskuryakov
Comment 4 2023-01-31 08:51:08 PST
While I don't have an answer about "discardable memory", I don't think that this optimization applies to WebKit, because CachedResource::didAccessDecodedData is already quick when the resource is not in cache: void CachedResource::didAccessDecodedData(MonotonicTime timeStamp) { m_lastDecodedAccessTime = timeStamp; if (allowsCaching() && inCache()) { auto& memoryCache = MemoryCache::singleton(); if (memoryCache.inLiveDecodedResourcesList(*this)) { memoryCache.removeFromLiveDecodedResourcesList(*this); memoryCache.insertInLiveDecodedResourcesList(*this); } memoryCache.pruneSoon(); } }
Note You need to log in before you can comment on or make changes to this bug.