Bug 1681771 Comment 11 Edit History

Note: The actual edited comment in the bug view page will always show the original commenter’s name and original timestamp.

It turns out changing the validForPretenuring is unnecessary.

The last minor GC is triggered by the test itself, and the nursery is not full yet (explained below), so validForPretenuring doesn't become true.
But it should have disabled nursery strings earlier,  it failed to do so because of the 4MB limit of nursery used bytes.
https://searchfox.org/mozilla-central/rev/c7cf087b6e1384608ca3989f042f12f7cabd0a5f/js/src/gc/Nursery.cpp#1196

And the reason why the nursery isn't full, is the tests has 500,000 strings.
The nursery starts with 0x40000 capacity, which holds 7836 strings 
then increase the capacity to 0x80000, which holds 16382 strings.
then 0x100000 capacity, -> 32764 strings
0x20000 capacity, 65528 strings
0x40000 capacity, 131056 strings
0x40000 capacity (already hits the max nursery size), 131056 strings.
7836 + 16382 + 32764 + 65528 + 131056 + 131056 = 384622.

The next round of minor Gc will hold (500000 - 384622) around 115000 strings, each string takes 32 bytes => 3680000 bytes, (0x382700 bytes) which are around 87% of the nursery capacity(0x400000).

But if we change the 4MB limit to 3MB(https://phabricator.services.mozilla.com/D99868), the string pretenuring could happen in the 3rd round of minor GC.

Talos link: (doesn't include the -qr platforms as it takes longer to run)
https://treeherder.mozilla.org/perfherder/compare?originalProject=mozilla-central&originalRevision=91a89ecd1d3a9f83a61549a1aaaf469b4746f301&newProject=try&newRevision=7dd176e18f17da133e55a13d4a1c7665d0755f64+&framework=1
It turns out changing the validForPretenuring is unnecessary.

The last minor GC is triggered by the test itself, and the nursery is not full yet (explained below), so validForPretenuring doesn't become true.
But it should have disabled nursery strings earlier,  it failed to do so because of the 4MB limit of nursery used bytes.
https://searchfox.org/mozilla-central/rev/c7cf087b6e1384608ca3989f042f12f7cabd0a5f/js/src/gc/Nursery.cpp#1196

And the reason why the nursery isn't full, is the tests has 500,000 strings.
The nursery starts with 0x40000 capacity, which holds 7836 strings 
then increase the capacity to 0x80000, which holds 16382 strings.
then 0x100000 capacity, -> 32764 strings
0x20000 capacity, 65528 strings
0x40000 capacity, 131056 strings
0x40000 capacity (already hits the max nursery size), 131056 strings.
7836 + 16382 + 32764 + 65528 + 131056 + 131056 = 384622.

The next round of minor Gc will hold (500000 - 384622) around 115000 strings, each string takes 32 bytes => 3680000 bytes, (0x382700 bytes) which are around 87% of the nursery capacity(0x400000).

But if we change the 4MB limit to 3MB(https://phabricator.services.mozilla.com/D99868), the string pretenuring could happen in the 5th round of minor GC.

Talos link: (doesn't include the -qr platforms as it takes longer to run)
https://treeherder.mozilla.org/perfherder/compare?originalProject=mozilla-central&originalRevision=91a89ecd1d3a9f83a61549a1aaaf469b4746f301&newProject=try&newRevision=7dd176e18f17da133e55a13d4a1c7665d0755f64+&framework=1

Back to Bug 1681771 Comment 11