Closed
Bug 1374011
Opened 8 years ago
Closed 9 months ago
substring shows up in Preact profiles
Categories
(Core :: JavaScript Engine, defect, P3)
Core
JavaScript Engine
Tracking
()
RESOLVED
WORKSFORME
Performance Impact | low |
People
(Reporter: ehsan.akhgari, Unassigned)
References
(Depends on 1 open bug, Blocks 1 open bug)
Details
(Keywords: perf, Whiteboard: [sp3])
Attachments
(1 file)
190 bytes,
text/html
|
Details |
Profile: http://bit.ly/2sKUasZ
Test case: http://speedometer2.benj.me/InteractiveRunner.html?suite=Preact-TodoMVC
The time spent here is under Adding100Items. It's not that much but perhaps something to look into. This is the code where the call comes from:
function y(e, t, n, o, r) {
if ("className" === t && (t = "class"), "class" === t && o && "object" === (void 0 === o ? "undefined" : fe(o)) && (o = a(o)), "key" === t);
else if ("class" !== t || r)
if ("style" === t) {
if ((!o || l(o) || l(n)) && (e.style.cssText = o || ""), o && "object" === (void 0 === o ? "undefined" : fe(o))) {
if (!l(n))
for (var s in n) s in o || (e.style[s] = "");
for (var c in o) e.style[c] = "number" != typeof o[c] || se[c] ? o[c] : o[c] + "px"
}
} else if ("dangerouslySetInnerHTML" === t) e.innerHTML = o && o.__html || "";
else if ("o" == t[0] && "n" == t[1]) {
var u = e._listeners || (e._listeners = {});
t = $(t.substring(2)), o ? u[t] || e.addEventListener(t, g, !!ce[t]) : u[t] && e.removeEventListener(t, g, !!ce[t]), u[t] = o
} else if ("list" !== t && "type" !== t && !r && t in e) b(e, t, null == o ? "" : o), null != o && o !== !1 || e.removeAttribute(t);
else {
var f = r && t.match(/^xlink\:?(.+)/);
null == o || o === !1 ? f ? e.removeAttributeNS("http://www.w3.org/1999/xlink", $(f[1])) : e.removeAttribute(t) : "object" === (void 0 === o ? "undefined" : fe(o)) || i(o) || (f ? e.setAttributeNS("http://www.w3.org/1999/xlink", $(f[1]), o) : e.setAttribute(t, o))
} else e.className = o || ""
}
On this reduced test case (I didn't bother looking up the name of the actual event handlers that flow through this code), Nightly gets ~3700 on my machine, Chrome unstable gets ~2800.
Comment 1•8 years ago
|
||
The self-hosted "Substring()" function also shows up in the Speedometer Backbone benchmark, where we inline it 1522 times. That function just does some basic Int32 coercion and calls SubstringKernel(), which we already know how to inline.
At least for that case, it would be good to teach Ion how to inline Substring() directly as a Native.
![]() |
||
Updated•8 years ago
|
Whiteboard: [qf:p3]
Comment 2•8 years ago
|
||
It seems we could kill Substring completely and do the coercion in SubstringKernel.
![]() |
||
Updated•8 years ago
|
Priority: -- → P3
Updated•4 years ago
|
Performance Impact: --- → P3
Whiteboard: [qf:p3]
Updated•3 years ago
|
Severity: normal → S3
Updated•3 years ago
|
Updated•3 years ago
|
Whiteboard: [sp3]
Updated•3 years ago
|
See Also: → https://mozilla-hub.atlassian.net/browse/SP3-125
Comment 3•9 months ago
|
||
Todays Nightly on the attached testcase from comment 0:
Nightly: Stabilizes at 630ms (https://share.firefox.dev/3C8cC4c)
Chrome: 840-860ms (https://share.firefox.dev/4adoOgR)
Should we close this bug, or is there anything worth optimizng further here?
Comment 4•9 months ago
|
||
Seems like we're doing fine on this. Given the existence of trial inlining, it's not obvious to me that eliminating Substring would be a win (comment 2), and other than that we didn't have any actionable ideas here.
Status: NEW → RESOLVED
Closed: 9 months ago
Resolution: --- → WORKSFORME
Comment 5•9 months ago
|
||
FWIW, i also tested by increasing and decreasing the loopcount by 10x and 100x, and we were faster in all cases.
You need to log in
before you can comment on or make changes to this bug.
Description
•