Untouched allocations in SkGlyphCache::findImage() |
||||||
Issue descriptionI ran an experiment to find out places where memory is allocated, but not touched (not read / written): https://groups.google.com/a/chromium.org/forum/#!topic/project-trim/1OfAa01uOa8 I found that SkGlyphCache::findImage() is responsible for 287 KiB of untouched bytes (out of 1.5 MiB). There is TODO in SkGlyphCache::findImage() about resizing image buffer, which looks like what's happening. How hard it'll be to actually do that?
,
Nov 7 2016
To Herb and/or Ben who play in this space...
,
Nov 7 2016
I'm currently working on that TODO, but I doubt it will make any difference. For efficiency the images are backed by a slab allocator so it is quite likely that there sill be a great deal of unused data at the end of the slabs at any given point. Your distribution of unused percentages is about what I would expect.
,
Nov 7 2016
I see. But since we want to shrink most recent allocation, perhaps SkChunkAlloc could introduce 'shrink(N)' method to shrink last allocation by N bytes? That way images should end up tightly packed.
,
Nov 7 2016
Actually, disregard that, I see that SkChunkAlloc basically allocates one block per image if image is sufficiently large. Shrinking won't help much.
,
Dec 15 2016
,
Jan 23 2017
I can see that as of https://skia-review.googlesource.com/c/7112/ SkGlyphCache uses SkArenaAlloc. I'll redo my experiment to see how it helped.
,
Aug 2 2017
Ping! This bug is assigned and has an owner, but hasn't been updated in over 180 days. Is this still something we want to do?
,
Aug 3 2017
I suppose this is to dskiba@ if they have time to redo testing with the latest code.
,
May 18 2018
Measurement code is hopelessly obsolete, so I can't redo the measurements. Optimistically marking as fixed. |
||||||
►
Sign in to add a comment |
||||||
Comment 1 by dskiba@chromium.org
, Nov 4 2016BTW, the distribution of unused sizes looks like this: [% unused] [total unused size] <10% 11.6 KiB 20% 46.7 KiB 30% 9.6 KiB 40% 25.7 KiB 50% 13.6 KiB 60% 14.8 KiB 70% 69.8 KiB 90% 78.5 KiB I.e. 78.5 KiB came from buffers that were >=90% unused.