firefox-devtools / profiler

Firefox Profiler — Web app for Firefox performance analysis
https://profiler.firefox.com
Mozilla Public License 2.0
1.19k stars 388 forks source link

Sluggish call tree performance in threads with lots of samples #3718

Open mstange opened 2 years ago

mstange commented 2 years ago

Steps to reproduce:

  1. Load this profile: https://share.firefox.dev/32Vqug9
  2. Use your arrow keys to change the selected row in the call tree.

Expected results: It should be snappy and fast.

Actual results: It is fairly sluggish.

Profile of sluggishness: https://share.firefox.dev/3lz1m5C

One big problem, as usual, is that the react render happens in the keydown handler, rather than from a requestAnimationFrame callback. So multiple keydowns are never batched.

┆Issue is synchronized with this Jira Task

julienw commented 2 years ago

One big problem, as usual, is that the react render happens in the keydown handler, rather than from a requestAnimationFrame callback. So multiple keydowns are never batched.

I wonder if React 18 helps with that 🤔

mstange commented 2 years ago

I wonder if React 18 helps with that 🤔

This document says no:

Note: React only batches updates when it’s generally safe to do. For example, React ensures that for each user-initiated event like a click or a keypress, the DOM is fully updated before the next event.