Bug 167797

Summary: Line-heavy SVG example spends a lot of time in SVGPointListValues::valueAsString()
Product: WebKit Reporter: Simon Fraser (smfr) <simon.fraser>
Component: SVGAssignee: Nobody <webkit-unassigned>
Status: NEW    
Severity: Normal CC: ahmad.saleem792, krit, sabouhallawa, simon.fraser, webkit-bug-importer, zimmermann
Priority: P2 Keywords: InRadar
Version: WebKit Nightly Build   
Hardware: Unspecified   
OS: Unspecified   
URL: https://codepen.io/monfera/pen/oLoRgX

Simon Fraser (smfr)
Reported 2017-02-03 09:48:36 PST
Load https://bl.ocks.org/monfera/fb2ba8d3b6c3fbeb5f1f54b7dc4d58ea and sample. Lots of time under: 2100 vmEntryToJavaScript (in JavaScriptCore) + 299 [0x1106c4ceb] 2093 ??? (in <unknown binary>) [0x2026beba1496] | 2092 WebCore::setJSSVGPointX(JSC::ExecState*, long long, long long) (in WebCore) + 380 [0x1125e194c] | + 2077 WebCore::SVGAttributeToPropertyMap::synchronizeProperty(WebCore::SVGElement&, WebCore::QualifiedName const&) const (in WebCore) + 121 [0x112aee7b9] | + ! 1943 WebCore::SVGPolyElement::synchronizePoints(WebCore::SVGElement*) (in WebCore) + 136 [0x112b4d3e8] | + ! : 952 WebCore::SVGPointListValues::valueAsString() const (in WebCore) + 350 [0x112b4d2be] | + ! : | 812 WTF::StringBuilder::appendNumber(double, unsigned int, WTF::TrailingZerosTruncatingPolicy) (in JavaScriptCore) + 53 [0x1108defe5] | + ! : | + 725 WTF::numberToFixedPrecisionString(double, unsigned int, char*, bool) (in JavaScriptCore) + 70 [0x10fed06e6] | + ! : | + ! 476 WTF::double_conversion::DoubleToStringConverter::ToPrecision(double, int, WTF::double_conversion::StringBuilder*) const (in JavaScriptCore) + 290 [0x10fed08a2] Ironically examples like this are cited as being slow because they don't use hardware acceleration, but in this case most of the time is in number-to-string code. Why so much?
Attachments
Simon Fraser (smfr)
Comment 1 2017-12-06 20:58:05 PST
Every time JS sets the x value of a point, we synchronously update the 'points' attribute of the polyline. It seems like we could do this lazily.
Simon Fraser (smfr)
Comment 2 2017-12-07 08:30:02 PST
That happens via this line in SVGAnimatedProperty::commitChange(): // Needed to synchronize with CSSOM for presentation attributes with SVG DOM. m_contextElement->synchronizeAnimatedSVGAttribute(m_attributeName); which was added in r171341. This patch has some explanation: https://bug-135046-attachments.webkit.org/attachment.cgi?id=235119
Radar WebKit Bug Importer
Comment 3 2017-12-07 08:30:33 PST
Note You need to log in before you can comment on or make changes to this bug.