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!
<rdar://problem/103855904>
Is "discardable memory" a concept we have in WebKit too?
(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.
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(); } }