Closed Bug 1919713 Opened 5 months ago Closed 4 months ago

JS Tracer can be very slow when debugging google docs

Categories

(DevTools :: Debugger, defect)

defect

Tracking

(firefox132 fixed)

RESOLVED FIXED
132 Branch
Tracking Status
firefox132 --- fixed

People

(Reporter: ochameau, Assigned: ochameau)

References

(Blocks 1 open bug)

Details

Attachments

(4 files)

The JS Tracer can be very slow and freeze the page for a few seconds to process the traces.
This is visible on the profiler:
https://share.firefox.dev/4d8NtTr

There is three performance issues with the following methods:

  • getFrameDepth
  • getFrameIndex
  • isBlackBoxed

These checks represent a sizeable part of computations in the traced thread when using the JS Tracer.

Assignee: nobody → poirot.alex
Status: NEW → ASSIGNED

We don't have to walk up to the top frame if any of the parent frame
already has its depth computed.

Using unique strings as keys for Map is actually costly because
the string is "atomized" in order to uniquely identify it.

Depends on: 1919910

A quick summary about the impact of all these patches.

I measure the time spent tracing while typing three characters in gdocs.

First, I recorded mozilla-central:
https://share.firefox.dev/4d8NtTr

And got the following time spent in the few optimized methods:

  • getFrameDepth (963ms)
  • onTracingFrame (632ms)
  • getFrameIndex (244ms)
  • isBlackBoxed (69ms)

attachment 9425780 [details] Fixed isBlackBoxed

https://share.firefox.dev/3XMLZtw

  • isBlackBoxed (4ms)

attachment 9425781 [details] Fixed getFrameDepth

https://share.firefox.dev/4d6J7wh

  • getFrameDepth (89ms)

attachment 9425782 [details] Fixed getFrameIndex

https://share.firefox.dev/4gvNCDl

  • getFrameIndex (126ms)

attachment 9426016 [details] Fix for clip-path

This one fix isn't targeting the page's content process, but the frontend rendering in the parent process.
Also I tested while typing 16 characters instead of 3, as it requires accumulating more events.

So here is a profile without this patch, for the parent process:
https://share.firefox.dev/3MR9VFX

  • Paint (1045ms)

And one profile with this patch:
https://share.firefox.dev/3XQyLfE

  • Paint (525ms)
Pushed by apoirot@mozilla.com: https://hg.mozilla.org/integration/autoland/rev/c4d8cd9bafeb [devtools] Avoid the extra costs of source ignore logic if no source is ignored. r=devtools-reviewers,jdescottes https://hg.mozilla.org/integration/autoland/rev/eea86b9a31ec [devtools] Speedup getFrameDepth in the js tracer. r=devtools-reviewers,nchevobbe https://hg.mozilla.org/integration/autoland/rev/ceab7816468c [devtools] Speedup getFrameIndex by not using key as index. r=devtools-reviewers,nchevobbe https://hg.mozilla.org/integration/autoland/rev/26ea21eb3e27 [devtools] Avoid using clip-path for really small items in the timeline. r=devtools-reviewers,nchevobbe
See Also: → 1920103

Perfherder has detected a devtools performance change from push c09c9bd01da846a99ca184ce7b07708e360897c9.

Improvements:

Ratio Test Platform Options Absolute values (old vs new)
15% damp jstracer.debugger-sidebar-performance.DAMP windows11-64-shippable-qr e10s fission stylo webrender 1,047.23 -> 888.03
15% damp jstracer.debugger-sidebar-performance.DAMP windows11-64-shippable-qr e10s fission stylo webrender 1,046.65 -> 889.03
11% damp jstracer.debugger-sidebar-performance.DAMP macosx1015-64-shippable-qr e10s fission stylo webrender 1,940.69 -> 1,721.06
9% damp jstracer.webconsole-performance.DAMP windows11-64-shippable-qr e10s fission stylo webrender 1,264.04 -> 1,146.59
9% damp jstracer.webconsole-performance.DAMP macosx1015-64-shippable-qr e10s fission stylo webrender 2,286.98 -> 2,089.24
... ... ... ... ...
2% damp jstracer.server-performance.DAMP windows11-64-shippable-qr e10s fission stylo webrender 819.33 -> 802.63

Details of the alert can be found in the alert summary, including links to graphs and comparisons for each of the affected tests.

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 2278

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: