Closed Bug 1660409 Opened 5 years ago Closed 5 years ago

Figure out what to do with ArrayJoinResult

Categories

(Core :: JavaScript Engine: JIT, task, P2)

task

Tracking

()

RESOLVED FIXED
82 Branch
Tracking Status
firefox82 --- fixed

People

(Reporter: jandem, Assigned: anba)

References

Details

Attachments

(4 files)

This is a very specific optimization for join on arrays with length <= 1. I'm a bit worried about supporting this in Warp because it feels like over-specialization that could easily result in bailouts. However, if we don't transpile it, we'll use the CallGeneric call path which isn't great. Maybe we should just disable this stub if Warp is enabled...

Another option is to call jit::ArrayJoin but that's just calling array_join anyway.

Severity: normal → N/A
Priority: -- → P2

Bug 1382837 has some numbers to explain why we optimise for length <= 1.

It looks like this was added for Speedometer, but I don't see any perf numbers reported in bug 1382837. If we disable this stub, does it affect Speedometer performance? If it doesn't, then maybe we can just eliminate it entirely.

Another option is to restrict to packed arrays and do a VM call to ArrayJoinDenseKernel, but that doesn't handle objects/symbols... Handling objects requires AutoCycleDetector and if we add that it's not clear how much faster it still is over array_join.

What if we change the CacheIR implementation to more closely match the inline code path in CodeGenerator? I.e. handle the zero and one element case inline and for all other cases perform a VM call?
-> https://treeherder.mozilla.org/#/jobs?repo=try&revision=176a02993e373bfa6f7b8c4629b1681ea1348d83

(In reply to André Bargull [:anba] from comment #6)

What if we change the CacheIR implementation to more closely match the inline code path in CodeGenerator? I.e. handle the zero and one element case inline and for all other cases perform a VM call?
-> https://treeherder.mozilla.org/#/jobs?repo=try&revision=176a02993e373bfa6f7b8c4629b1681ea1348d83

That looks great. Thanks!

Change to unshared CacheIR op in preparation for part 3.

Assignee: nobody → andrebargull
Status: NEW → ASSIGNED

Add a new CacheIR op to load a constant string in preparation for part 3.

Depends on D88561

Use a CallVM instead of a FailurePath to match the Ion optimised path. This
change will allow part 4 to use the existing MArrayJoin call for Warp.

Depends on D88562

Depends on D88564

You read my mind :) I was just looking at some micro-benchmarks for this and, not surprisingly, --warp is indeed 6x slower than Baseline (--no-ti) on the one below.

function f() {
    var arr = [];
    var res = "";
    var t = dateNow();
    for (var i = 0; i < 10_000_000; i++) {
        res = arr.join(",");
    }
    print(dateNow() - t);
    print(res);
}
f();
Pushed by malexandru@mozilla.com: https://hg.mozilla.org/integration/autoland/rev/29976a2bca84 Part 1: Change ArrayJoin to an unshared op. r=jandem https://hg.mozilla.org/integration/autoland/rev/fa309b2541bf Part 2: Add LoadConstantString CacheIR op. r=jandem https://hg.mozilla.org/integration/autoland/rev/bab7bab23941 Part 3: Change CacheIR ArrayJoin to use a VMCall instead of a FailurePath. r=jandem
Status: ASSIGNED → RESOLVED
Closed: 5 years ago
Resolution: --- → FIXED
Target Milestone: --- → 82 Branch

Just curious, but I see a patch in Lando not showing as landed yet the bug is closed. Is this intended?

Flags: needinfo?(andrebargull)

(In reply to K Carter from comment #15)

Just curious, but I see a patch in Lando not showing as landed yet the bug is closed. Is this intended?

Ah, thanks for noticing! I didn't set the "check-in needed" flag at the top of stack, so the last commit wasn't committed.

Flags: needinfo?(andrebargull)
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Created:
Updated:
Size: