Open Bug 2098736 Opened 3 hours ago Updated 2 hours ago

Cache the shape of a promise and use it for promise allocation

Categories

(Core :: JavaScript Engine, task)

task

Tracking

()

ASSIGNED

People

(Reporter: mgaudet, Assigned: mgaudet)

References

(Blocks 1 open bug)

Details

Attachments

(1 external file)

Rather than taking slow path through hash table

Every promise created without an explicit prototype went through
NewObjectWithClassProto, which loads %Promise.prototype% from the global and
then looks up the initial shape for it in the zone's initial shape table. The
prototype load is cheap; the shape table lookup, a hash table lookup per
promise, is what this removes. Promise-heavy code creates promises at a high
rate (by Promise.resolve, Promise.prototype.then, async functions and so on),
so cache the shape on the global, as is done for arrays, functions, bound
functions and RegExps, and allocate with it directly.

On JetStream doxbee-promise in the shell this is a further 3.7% improvement on
top of the preceding patches (33.59 ms to 32.36 ms per iteration).

Assignee: nobody → mgaudet
Status: NEW → ASSIGNED
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Created:
Updated:
Size: