Closed Bug 1405330 Opened 7 years ago Closed 7 years ago

Clean up and optimize Promise debugger hooks

Categories

(Core :: JavaScript Engine, enhancement)

enhancement
Not set
normal

Tracking

()

RESOLVED FIXED
mozilla58
Tracking Status
firefox58 --- fixed

People

(Reporter: jandem, Assigned: jandem)

References

(Blocks 2 open bugs)

Details

Attachments

(1 file)

Attached patch PatchSplinter Review
The Promise constructor spends quite a lot of time under JS::dbg::onNewPromise. Fortunately this no longer has to be a public API and we can now simplify/optimize this code. In particular the fast path can just check cx->compartment()->isDebuggee().

This improves the micro-benchmark below from 360-390 ms to 340-350 ms with --no-async-stacks so it's a pretty easy win.

function f() {
    var count = 1000000;
    var start = Date.now();
    for (var i = 0; i < count; ++i) {
        new Promise(r => void 0);
    }
    var stop = Date.now();
    print(stop - start);
}
f();
Attachment #8914760 - Flags: review?(till)
Comment on attachment 8914760 [details] [diff] [review]
Patch

Review of attachment 8914760 [details] [diff] [review]:
-----------------------------------------------------------------

Nice easy win indeed, thanks!
Attachment #8914760 - Flags: review?(till) → review+
Pushed by jandemooij@gmail.com:
https://hg.mozilla.org/integration/mozilla-inbound/rev/0b08540034c0
Clean up and optimize Promise debugger hooks. r=till
Blocks: 1342037
Pushed by jandemooij@gmail.com:
https://hg.mozilla.org/integration/mozilla-inbound/rev/df08c7645b1a
Clean up and optimize Promise debugger hooks. r=till
Flags: needinfo?(jdemooij)
https://hg.mozilla.org/mozilla-central/rev/df08c7645b1a
Status: ASSIGNED → RESOLVED
Closed: 7 years ago
Resolution: --- → FIXED
Target Milestone: --- → mozilla58
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Created:
Updated:
Size: