New issue
Advanced search Search tips
Note: Color blocks (like or ) mean that a user may not be available. Tooltip shows the reason.

Issue 613662 link

Starred by 15 users

Issue metadata

Status: Available
Owner: ----
Cc:
Components:
EstimatedDays: ----
NextAction: ----
OS: All
Pri: 3
Type: Bug

Blocked on:
issue 709437


Show other hotlists

Hotlists containing this issue:
Nice-to-haves-for-Project-V


Sign in to add a comment

Painting SVG images can spent a lot of time doing layout if it has multiple embed points

Project Member Reported by rbyers@chromium.org, May 20 2016

Issue description

Running through a CQ now to see: https://codereview.chromium.org/1996363003
Cc: f...@opera.com
From fs@opera:

The reason FrameView::updateAllLifecyclePhasesExceptPaint is called where it is, is because of the FrameView::resize (and FrameView::processUrlFragment) call(s) at the beginning of the function. In turn the reason for that is the context-sensitivity of SVG image - depending on the embedding context sizes (and other things - c.f processUrlFragment) can change.

I guess the interesting bit here is if this is a no-op or not. (9% sounds like an expensive no-op...)
Why is an SVGImage adjusting size and url fragment in paint? That should be
done during layout or earlier.

Comment 4 by f...@opera.com, May 20 2016

The core of the problem I'd say is the 1:N mapping - a single SVGImage is mapped to multiple potential instantiation points ("viewports") in the document. Since there's still only one of most (all) things, one layout et.c would destroy the result of the previous (which will happened with different dimensions et.c.)

(I get a bit of a deja vu feeling here, but I couldn't find a dupe...)
Ok. First step, I'm working on a patch to avoid updating the lifecycle if
those two call sites have no effect.
The patch removes a number of lifecycle calls. However, some of the stars
in the animation for 'HTML suite > DOM particles, SVG masks' are of different
sizes, and they all use the same SVG mask. Therefore with the current method
of having one SVGImage to represent the mask with a single layout, we are forced
to redo its lifecycle when it changes. In my tests the full lifecycle is dominated by layout,
as one would expect.

Comment 7 by f...@opera.com, May 20 2016

Looks like the mask (star) is made up of four (layout tree) nodes - and the way things currently all would be laid out. Could quite likely get that down only one (the root), but not sure whether that would make a noticeable difference or not - presumably depends on how the overhead is distributed.

Comment 8 Deleted

Unassigning this bug. I think any fix will require significant work and thought.

In other words: I don't think we can significantly improve performance of this
right now. Early-outing if the frame rect or fragment url didn't change did not
have a huge impact on the referenced use case.
Project Member

Comment 11 by sheriffbot@chromium.org, May 24 2017

Labels: Hotlist-Recharge-Cold
Status: Untriaged (was: Available)
This issue has been Available for over a year. If it's no longer important or seems unlikely to be fixed, please consider closing it out. If it is important, please re-triage the issue.

Sorry for the inconvenience if the bug really should have been left as Available. If you change it back, also remove the "Hotlist-Recharge-Cold" label.

For more details visit https://www.chromium.org/issue-tracking/autotriage - Your friendly Sheriffbot

Comment 12 by f...@opera.com, May 24 2017

Status: Available (was: Untriaged)

Comment 13 by f...@opera.com, May 24 2017

Labels: -Hotlist-Recharge-Cold
Project Member

Comment 14 by sheriffbot@chromium.org, May 24 2018

Labels: Hotlist-Recharge-Cold
Status: Untriaged (was: Available)
This issue has been Available for over a year. If it's no longer important or seems unlikely to be fixed, please consider closing it out. If it is important, please re-triage the issue.

Sorry for the inconvenience if the bug really should have been left as Available.

For more details visit https://www.chromium.org/issue-tracking/autotriage - Your friendly Sheriffbot

Comment 15 by f...@opera.com, May 25 2018

Status: Available (was: Untriaged)
Cc: flackr@chromium.org pdr@chromium.org enne@chromium.org
 Issue 681611  has been merged into this issue.
Issue 849470 has been merged into this issue.
Hi, I'm surprised rendering of SVGs can be this slow. I've created a simple example that shows the problem clearly (below).

If this is an old known issue, is there also a known workaround? Is Chrome unable to handle many SVGs in general, or is there a specific way in which they need to be added? Chrome can hang up for 10+ minutes on a high performance machine if the page creates 1,000 trivial SVGs.

========================================
<html>
<head><meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<script>
function onLoad() {
	for (let i = 0; i < 300; i++) {
		let svg = document.createElement("OBJECT");
		svg.className = "svg";
		svg.type = 'image/svg+xml';
		svg.data = "https://dev.w3.org/SVG/tools/svgweb/samples/svg-files/android.svg";
		document.body.appendChild(svg);
	}
}
</script>
<style>.svg { width:24px; height: 24px }</style>
</head>
<body id="body" onload="onLoad()">
	
</body>
</html>
Cc: rmargold@google.com

Comment 20 by f...@opera.com, Jun 5 2018

@c#18: This bug is about SVG images embedded in "image contexts" (<img> and various CSS properties for example.) That differs significantly from the case you demonstrate which is not an "image context". Your case is not very different from loading 300 iframes, although I think the loading pipeline interaction is worse off. You can test this out yourself by replacing "OBJECT" with "img" (and .data with .src) to notice the difference. This has been noted before in for example issue 608304. So while it's an interesting case, it's not the case this bug is about, so let's not conflate things.
I should unmerge the bugs then.
@c#20 Thanks for the input! Indeed replacing OBJECT with IMG changes the render time dramatically. (And unfortunately comes with other issues)
Blockedon: 709437
 Issue 917600  has been merged into this issue.

Sign in to add a comment