Closed Bug 869611 Opened 12 years ago Closed 12 years ago

Stop reflowing in nsSVGPathGeometryFrame::NotifySVGChanged when transforms change

Categories

(Core :: SVG, defect)

defect
Not set
normal

Tracking

()

RESOLVED FIXED
mozilla23

People

(Reporter: jwatt, Assigned: jwatt)

References

(Blocks 1 open bug)

Details

(Keywords: perf)

Attachments

(2 files)

Right now nsSVGPathGeometryFrame::NotifySVGChanged schedules a reflow of itself without checking aFlags. This means that when aFlags is just set to TRANSFORM_CHANGED (i.e. a transform changed on an ancestor of the frame) it is unnecessarily reflowing. This is preventing us from benefiting from layers when transforms are animating on ancestors, which is a huge waste. The only reason for us to reflow for a change on an ancestor at this point in the code is if the element's geometry has a percentage value that is resolved against the nearest coordinate context. (Note that we don't need to update the frames overflow rects for TRANSFORM_CHANGED since its only if the frame's _own_ transform changes that we need to do that.) I'll add some logic to expose that information and knock up a patch to make use of it.
Attached patch patchSplinter Review
Attachment #746579 - Flags: review?(dholbert)
Further 5x speed-up on bug 852588 (Santa's Workshop).
Comment on attachment 746579 [details] [diff] [review] patch Generally looks good. > bool >+nsSVGPathGeometryElement::GeometryDependsOnCoordCtx() const >+{ >+ // Check the nsSVGLength2 attribute I think this wants to be "attributes" (plural)? >+ LengthAttributesInfo info = const_cast<nsSVGPathGeometryElement*>(this)->GetLengthInfo(); The const / const_cast dance here is a bit hacky & seems unnecessary. There's only one caller, and it doesn't have a const-restricted pointer, so no need for this method to be const. r=me with that
Attachment #746579 - Flags: review?(dholbert) → review+
(In reply to Daniel Holbert [:dholbert] from comment #3) > >+ LengthAttributesInfo info = const_cast<nsSVGPathGeometryElement*>(this)->GetLengthInfo(); > > The const / const_cast dance here is a bit hacky & seems unnecessary. > There's only one caller, and it doesn't have a const-restricted pointer, so > no need for this method to be const. Alternately, I think GetLengthInfo() can probably be made to be a const method. I'll give that a shot right now over in bug 869679... If you'd like to keep GeometryDependsOnCoordCtx as const and layer this on top of that bug (without the need for the hacky const_cast anymore), that's fine too. (assuming bug 869679 works out)
(Actually, disregard comment 4 -- GetLengthInfo can't be converted to const, as I just noted in bug 869679 comment 1, though we could probably add an alternate const version if it's useful enough. I'm not going to bother with that myself, but you may want to if you'd really like GeometryDependsOnCoordCtx to be const. :))
Depends on: 869781
Attached file breaktest
Here's a reduced testcase from the the "svg/as-image" reftests that currently fail, in builds with the patch applied. This testcase is actually taken from the *reference* case (img-height-slice-1-ref.html) because that's what changes rendering when this patch is applied. (So that's for SVG in <embed>, not for SVG-as-an-image.)
Thanks, Daniel. This is actually fixed by my latest patch in bug 869781.
Blocks: 847653
woot!
Blocks: 835041
Status: NEW → RESOLVED
Closed: 12 years ago
Resolution: --- → FIXED
Target Milestone: --- → mozilla23
Blocks: 732108
Depends on: 875069
This more than doubled the performance of the Santa's Workshop demo (bug 852588) for me. Not too surprising really.
Blocks: 722090
This sped up the IE Test Drive Helicopter demo quite substantially; for me it went from 15-20 "fps" to 30-35 "fps".
Blocks: 608495
Depends on: 938555
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Created:
Updated:
Size: