Optimize the allocation of Maps and internal allocations by Maps
Categories
(Core :: JavaScript Engine: JIT, enhancement, P3)
Tracking
()
People
(Reporter: nickolay8, Unassigned)
References
(Blocks 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:
- Open the https://bryntum.com/products/gantt/examples/bigdataset/ page.
- In console, type: window.DEBUG = true
- 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 nativeMap.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
Updated•2 years ago
|
Comment 1•1 year ago
•
|
||
Methodology:
- Open webdev console
- window.DEBUG = true
- close the webdev console
- wait till CPU activity reduces.
Latest Firefox Nightly:
09:51:54.136 generate: 7.86ms - timer ended gantt.module.js:363:2379344
09:51:54.269 Initializing project gantt.module.js:363:2023842
09:51:55.882 Populating project: 1612.58ms - timer ended gantt.module.js:363:2025016
09:52:03.361 Time to visible: 9089.74ms - timer ended gantt.module.js:363:2001405
09:52:05.201 Finalize propagation: 1809.52ms - timer ended
Latest Chrome Release:
generate: 13.669921875 ms
gantt.module.js?480175:363 Initializing project
gantt.module.js?480175:363 Populating project: 526.87109375 ms
gantt.module.js?480175:363 Time to visible: 3881.3671875 ms
gantt.module.js?480175:363 Finalize propagation: 446.77001953125 ms
Results
Populating project: Firefox is 3x slower than Chrome (21x slower previously)
Time to visible: Firefox is 2.3x slower than Chrome (30x slower previously)
Updated•1 year ago
|
Comment 2•1 year ago
•
|
||
Nightly:
Profile: https://share.firefox.dev/4iI5prb
08:06:05.773 generate: 10.2ms - timer ended gantt.module.js:363:2719287
08:06:05.889 Initializing project gantt.module.js:363:2038560
08:06:06.552 Populating project: 662.32ms - timer ended gantt.module.js:363:2039769
08:06:11.955 Time to visible: 6066.16ms - timer ended gantt.module.js:363:2015346
08:06:12.740 Finalize propagation: 764.24ms - timer ended
Chrome:
https://share.firefox.dev/4hm0zid
generate: 2.994873046875 ms
gantt.module.js?483367:363 generate: 9.986083984375 ms
gantt.module.js?483367:363 Initializing project
gantt.module.js?483367:363 Populating project: 402.598876953125 ms
gantt.module.js?483367:363 Time to visible: 3237.31201171875 ms
gantt.module.js?483367:363 Finalize propagation: 438.744140625 ms
Description
•