Closed Bug 1687602 Opened 4 months ago Closed 4 months ago

Optimize JSFunction allocation in Stencil

Categories

(Core :: JavaScript Engine, task, P1)

task

Tracking

()

RESOLVED FIXED
86 Branch
Tracking Status
firefox86 --- fixed

People

(Reporter: tcampbell, Assigned: tcampbell)

References

(Blocks 1 open bug)

Details

Attachments

(1 file)

For large JS files, we can have 10's of thousands of individual functions. Even with syntax parsing, we must allocate a JSFunction for each when we instantiate the CompilationStencil. Currently we use NewFunctionWithProto which is quite general purpose and involves many hashtable lookups for shape, group, etc. With stencil we allocate JSFunction in a single batch and nearly all of them have the same shape/group, so we should precompute the shape/group and add a fast path.

Netflix player code is an example that benefits noticeably from this. We can eliminate about 20% of Stencil instantiation time.

Most parser-generated functions have the same prototype, initial-shape and
group and by caching those values we can speed up JSFunction allocation
significantly.

Attachment #9198077 - Attachment description: Bug 1687602 - (Prototype) Optimize JSFunction allocation in Stencil → Bug 1687602 - Optimize JSFunction allocation in Stencil. r?jandem!
Pushed by tcampbell@mozilla.com:
https://hg.mozilla.org/integration/autoland/rev/3f090cebbdd2
Optimize JSFunction allocation in Stencil. r=jandem
Status: NEW → RESOLVED
Closed: 4 months ago
Resolution: --- → FIXED
Target Milestone: --- → 86 Branch
You need to log in before you can comment on or make changes to this bug.