Don't update MemoryCache during drawImage if the image is decoded into DiscardableMemory
Profiling data from perf for content_shell on android shows that ImageResource::didDraw is a bottleneck when drawImage APIs are frequently called in Canvas2D benchmarks. ImageResource::didDraw update info (access time, etc) in MemoryCache and prune the cache if necessary. But Images are decoded into DiscardableMemory, which is another cache mechanism except for MemoryCache. Images are not in MemoryCache at all, so we don't need to update the info in MemoryCache for these resources. This small CL avoid updating MemoryCache during drawImage to improve performance. Table below lists how much BitmapResource::didDraw costs in the whole render process w/ or w/o this CL. All benchmarks are tested on Nexus 7. benchmark original percentage CL applied percentage speedReading 6.9 % 0.05 % GM3 bitmap 4.5 % 0.04 % The FPS of speedReading improved more than 5%. The FPS of GM3_Bitmap improved a little, because the original FPS is as high as 58. For other Canvas2D benchmarks(FishIETank, Galactic, etc), BitmapResource::didDraw costs ~1.5%. After this CL is applied, it costs about 0.02%. The FPS of these benchmarks basically keeps the same because didDraw in these cases is not as heavy as it is in speedReading/GM3_Bitmap. BUG=410663 Review URL: https://codereview.chromium.org/534963003 git-svn-id: svn://svn.chromium.org/blink/trunk@181430 bbb929c8-8fbe-4397-9dbb-9b2b20218538
Showing
Please register or sign in to comment