Bug 167797
Summary: | Line-heavy SVG example spends a lot of time in SVGPointListValues::valueAsString() | ||
---|---|---|---|
Product: | WebKit | Reporter: | Simon Fraser (smfr) <simon.fraser> |
Component: | SVG | Assignee: | 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)
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 | ||
---|---|---|
Add attachment proposed patch, testcase, etc. |
Simon Fraser (smfr)
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)
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
<rdar://problem/35909900>