Closed Bug 1872982 Opened 5 months ago Closed 5 months ago

A demo spends ~2minutes completely around GC (GCMinor?)

Categories

(Core :: JavaScript Engine, task)

task

Tracking

()

RESOLVED FIXED
123 Branch
Tracking Status
firefox123 --- fixed

People

(Reporter: mayankleoboy1, Assigned: jonco)

References

(Blocks 1 open bug, )

Details

Attachments

(2 files)

Go to https://davidsaltacc.github.io/pages/generative-art/fractals-v1
QUICKLY slide the first slider "size" all the way to the right

AR: https://share.firefox.dev/48K1p4J (1m40s spend completely around GC)
ER: maybe something to improve here?

Edit: Profile from Chrome is https://share.firefox.dev/4aN3G0w

Summary: A demo spends ~2minutes completely around GC → A demo spends ~2minutes completely around GC (GCMinor?)

From reading the profile, it seems that the code is creating many TypedArrays using TypedArray.prototype.subarray. TypedArray.prototype.subarray creates a new TypedArray, but shares the ArrayBuffer with the source TypedArray. This leads to registering the ArrayBuffer in InnerViewTable. And the profile seems to spend most of the time cleaning up these InnerViewTable entries.

Assignee: nobody → jcoppeard

This page creates millions of long lived views for a single ArrayBuffer. Currently these are all swept on minor GC to clean up nursery allocated ones, but this ends up being very inefficient when most of them are not in the nursery.

To make it clearer what's going on this replaces JSObject with
ArrayBufferObject and ArrayBufferViewObject where possible and does some other
tidy ups.

This patch changes the inner view vector to store all nursery views at the end,
and records the index of the first nursery view. This allows us to sweep only
the nursery views after minor GC.

For the page in question this reduces the proportion of time spent in GC from
100% to around 35%.

Depends on D197775

Pushed by jcoppeard@mozilla.com:
https://hg.mozilla.org/integration/autoland/rev/ab95bea5cab2
Part 1: Use more sepecific types in InnerViewTable r=jandem
https://hg.mozilla.org/integration/autoland/rev/009227ccd93a
Part 2: Partition inner view vector based on whether the view is in the nursery r=jandem
Status: NEW → RESOLVED
Closed: 5 months ago
Resolution: --- → FIXED
Target Milestone: --- → 123 Branch

This now takes 3.5 seconds, which is a pretty drastic improvement!
https://share.firefox.dev/3vs9gFG

You need to log in before you can comment on or make changes to this bug.

Attachment

General

Created:
Updated:
Size: