Closed Bug 1900982 Opened 3 months ago Closed 3 months ago

Use arrays instead of objects in the tracer resources

Categories

(DevTools :: Debugger, enhancement)

enhancement

Tracking

(firefox129 fixed)

RESOLVED FIXED
129 Branch
Tracking Status
firefox129 --- fixed

People

(Reporter: ochameau, Assigned: ochameau)

References

Details

Attachments

(2 files)

The tracer currently uses objects to communicate stacks and frames.
This is a source of performance bottleneck as these JSON objects are ultimately stringified and represents larger packets than their equivalents in arrays.
This is also a significant difference between the tracer and the profiler. The profiler is using arrays in the uploaded profile.
Using arrays should help better integrate with the profiler and share more code between the devtools live tracer and the recorded tracer.

Profile of mozilla-central, using objects and logging to the console:
https://share.firefox.dev/3XiwHNg

Profile with the patch, using arrays and also logging to the console:
https://share.firefox.dev/3Re4sf3

Against the following test:
data:text/html,<script>window.onclick=()=>{for(let i = 0; i < 10000; i++) a()}; function a(){}</script>

From the content process, flushTraces/emitTraces is significantly faster. From 25ms to 9ms.
This is small number on this test page, but flushTraces can be a much slower step on large websites.

Using arrays speeds up the serialization and transmission of traces between the server and the client
as it goes through JS Actors/IPC by serializing the JSON RDP packets.

This also allows to better align with the profiler data format.

Assignee: nobody → poirot.alex
Status: NEW → ASSIGNED
Attachment #9406373 - Attachment description: Bug 1900982 - [devtools] Cover the backend performance of the JS tracer. → Bug 1900982 - [devtools] Cover the performance of the JS tracer.
Attachment #9406373 - Attachment description: Bug 1900982 - [devtools] Cover the performance of the JS tracer. → Bug 1900982 - [devtools] Cover the backend performance of the JS tracer.
Pushed by apoirot@mozilla.com:
https://hg.mozilla.org/integration/autoland/rev/39e79beba8f9
[devtools] Cover the backend performance of the JS tracer. r=perftest-reviewers,devtools-reviewers,kshampur,nchevobbe
https://hg.mozilla.org/integration/autoland/rev/2cd0e475a654
[devtools] Migrate JS tracer from Objects to Array as trace payloads. r=devtools-reviewers,perftest-reviewers,kshampur,nchevobbe
Status: ASSIGNED → RESOLVED
Closed: 3 months ago
Resolution: --- → FIXED
Target Milestone: --- → 129 Branch

Perfherder has detected a devtools performance change from push 2cd0e475a6543ca9fbf0f71d934d5b81fbcd6f1b.

Regressions:

Ratio Test Platform Options Absolute values (old vs new)
19% damp custom.jsdebugger.close.DAMP windows10-64-shippable-qr e10s fission stylo webrender-sw 18.11 -> 21.51
18% damp custom.jsdebugger.close.DAMP macosx1015-64-shippable-qr e10s fission stylo webrender-sw 14.03 -> 16.62
17% damp custom.jsdebugger.close.DAMP windows10-64-shippable-qr e10s fission stylo webrender 18.38 -> 21.51
15% damp custom.jsdebugger.close.DAMP macosx1015-64-shippable-qr e10s fission stylo webrender 14.27 -> 16.48
11% damp custom.netmonitor.close.DAMP macosx1015-64-shippable-qr e10s fission stylo webrender-sw 15.07 -> 16.80
11% damp custom.netmonitor.close.DAMP windows10-64-shippable-qr e10s fission stylo webrender-sw 18.29 -> 20.22
10% damp custom.netmonitor.close.DAMP macosx1015-64-shippable-qr e10s fission stylo webrender 15.42 -> 17.00
9% damp custom.netmonitor.close.DAMP windows10-64-shippable-qr e10s fission stylo webrender 18.28 -> 19.96
7% damp custom.jsdebugger.stepIn.DAMP windows10-64-shippable-qr e10s fission stylo webrender-sw 2,680.95 -> 2,876.15
7% damp custom.netmonitor.reload.DAMP macosx1015-64-shippable-qr e10s fission stylo webrender 238.02 -> 254.06
... ... ... ... ...
5% damp custom.netmonitor.requestsFinished.DAMP macosx1015-64-shippable-qr e10s fission stylo webrender-sw 1,590.17 -> 1,675.53
5% damp panelsInBackground.reload.DAMP windows10-64-shippable-qr e10s fission stylo webrender-sw 413.86 -> 435.77
5% damp custom.netmonitor.requestsFinished.DAMP macosx1015-64-shippable-qr e10s fission stylo webrender 1,601.87 -> 1,674.67
5% damp browser-toolbox.debugger-ready.DAMP windows10-64-shippable-qr e10s fission stylo webrender 638.73 -> 667.68
2% damp custom.netmonitor.open.DAMP windows10-64-shippable-qr e10s fission stylo webrender-sw 168.12 -> 171.75

Improvements:

Ratio Test Platform Options Absolute values (old vs new)
10% damp simple.netmonitor.close.DAMP windows10-64-shippable-qr e10s fission stylo webrender 6.45 -> 5.80
5% damp custom.jsdebugger.pretty-print.DAMP windows10-64-shippable-qr e10s fission stylo webrender 1,688.78 -> 1,609.10
2% damp custom.jsdebugger.stepInNewSource.DAMP windows10-64-shippable-qr e10s fission stylo webrender-sw 1,862.78 -> 1,824.10
2% damp simple.netmonitor.open.DAMP windows10-64-shippable-qr e10s fission stylo webrender 154.43 -> 151.30

As author of one of the patches included in that push, we need your help to address this regression.
Details of the alert can be found in the alert summary, including links to graphs and comparisons for each of the affected tests. Please follow our guide to handling regression bugs and let us know your plans within 3 business days, or the patch(es) may be backed out in accordance with our regression policy.

If you need the profiling jobs you can trigger them yourself from treeherder job view or ask a sheriff to do that for you.

You can run these tests on try with ./mach try perf --alert 737

For more information on performance sheriffing please see our FAQ.

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

Attachment

General

Created:
Updated:
Size: