Open Bug 1374011 Opened 7 years ago Updated 3 months ago

substring shows up in Preact profiles

Categories

(Core :: JavaScript Engine, defect, P3)

defect

Tracking

()

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)

Attached file reduced test case
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.
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.
Whiteboard: [qf:p3]
It seems we could kill Substring completely and do the coercion in SubstringKernel.
Priority: -- → P3
Keywords: perf
Performance Impact: --- → P3
Whiteboard: [qf:p3]
Severity: normal → S3
Blocks: 1801194
No longer blocks: 1245279
Depends on: 1812655
Whiteboard: [sp3]
See Also: → 1875809
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Created:
Updated:
Size: