Open Bug 1895667 Opened 5 months ago Updated 5 months ago

Optimize the allocation of Maps and internal allocations by Maps

Categories

(Core :: JavaScript Engine: JIT, enhancement, P3)

Firefox 116
enhancement

Tracking

()

UNCONFIRMED

People

(Reporter: nickolay8, Unassigned)

References

(Depends on 1 open bug)

Details

User Agent: Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/124.0.0.0 Safari/537.36

Steps to reproduce:

We found that allocation time of lots of Map instances is much slower than in Chrome. To be precise, its the allocation of subclasses of native Map class and it is 30x slower.

To reproduce:

  1. Open the https://bryntum.com/products/gantt/examples/bigdataset/ page.
  2. In console, type: window.DEBUG = true
  3. Click the "5K Tasks" button in the top toolbar. This will switch the example gantt to a new dataset of 5K tasks.

You should see the following output in console:

For Chrome:

window.DEBUG = true
true
generate: 25.85107421875 ms
Initializing project
Populating project: 887.9541015625 ms
Time to visible: 5474.97509765625 ms
Finalize propagation: 708.40185546875 ms

For Firefox:

window.DEBUG = true
true
generate: 303ms - timer ended
Initializing project
Populating project: 18714ms - timer ended 
Time to visible: 168067ms - timer ended 
Finalize propagation: 21519ms - timer ended

Actual results:

What happens here is:

  • generate - the example data is generated, not related to this issue.
  • Populating project - example data is loaded into "reactive graph". This instantiates lots of Map objects (like hundreds of thousands of them). 21x slowdown compared to Chrome. Again, to be precise, those objects are instances of subclass of native Map.
  • Time to visible - . Here the "reactive graph" calculates the final state. 30x slowdown compared to Chrome. During calculations, lots of graph edges are allocated (populates lots of Map instances).
  • Finalize propagation - not related to this issue.

Expected results:

I'd expect the Populating project metric to be comparable to Chrome or at least have less drastic difference. Populating project tracks the allocation of Maps.

I'd also expect Time to visible metric to be comparable to Chrome. It performs a lot of Map population (and a lot of internal allocations by Map). It also peforms a lot of generator-based calculations, for which we've opened a separate issue: https://bugzilla.mozilla.org/show_bug.cgi?id=1317690

Depends on: 1851662
Severity: -- → N/A
Priority: -- → P3
You need to log in before you can comment on or make changes to this bug.