This is improved a lot now.
Total improvement: 4.4s ->1.0s
First fix (4.4->3.2s) : Bug 1817640 - extract calculation of max dirty value to a helper method EffectiveMaxDirty(), r=pbone
Second fix (3.2->2.2s): Bug 1609478 - Poison memory we want to free before we take the arena lock r=glandium
Third fix (2.2->1.5s): Bug 1827258 part 4 - Add fast paths for optimizing common cases with packed arrays. r=jonco