Bug 158281

Summary: SVGImage should report a more accurate memory cost for its decoded data
Product: WebKit Reporter: Said Abou-Hallawa <sabouhallawa>
Component: SVGAssignee: Nobody <webkit-unassigned>
Status: NEW ---    
Severity: Normal CC: sabouhallawa, webkit-bug-importer, zimmermann
Priority: P2 Keywords: InRadar
Version: WebKit Nightly Build   
Hardware: Unspecified   
OS: Unspecified   
See Also: https://bugs.webkit.org/show_bug.cgi?id=158139

Description Said Abou-Hallawa 2016-06-01 16:03:39 PDT
In http://trac.webkit.org/changeset/201334, a simple calculation for the SVGImage memory cost was implemented. A more accurate but fast solution is required for better memory and resource caching utilization. Two solutions should be investigated:

1. A through navigation for the DOM and the render trees of the SVGImage accounting all the big memory chunks especially the vectors and the expensive cached graphics resources, e.g. the Path object. The down side of this approach is it is very costly and it's likely to become stale over time. 

2. Assume the SVGImage decoded data (the DOM and the render trees) is a ratio of the encoded data. This would require some heuristic to get this ratio offline. The ratio can be applied on the SVGImage level itself; e.g. sizeof_decoded_SVGImage = sizeof_encoded_SVGImage x decoding_ratio. Its down side is it is hard to get a good estimate for decoding_ratio. Also the result can be an inaccurate estimate especially if the SVG includes shared resources and they are referenced many times.
Comment 1 Radar WebKit Bug Importer 2016-06-01 16:10:30 PDT
<rdar://problem/26588995>
Comment 2 Radar WebKit Bug Importer 2016-06-01 16:13:17 PDT
<rdar://problem/26589087>