Skip to content

Conversation

@LalitMaganti
Copy link
Member

@LalitMaganti LalitMaganti commented Jan 17, 2026

The state at HEAD: on every mouse move, we would trigger a full DOM
redraw because it's possible the tooltip state may have been updated.
This is unnecessary as most of the time when mouse move happens, we're
either staying on the same hovered object OR (more common), we're not
hovering over anything at all.

Fix this by keeping track of the previous hovered object and only triggering
a redraw if it really changes.

Before (notice how the dom redraw count goes up as I move my mouse):

cast.webm

After (notice how the count doesn't change):

After.screencast.webm

The state at HEAD: on every mouse move, we would trigger a full DOM
redraw because it's possible the tooltip state may have been updated.
This is unnecessary as most of the time when mouse move happens, we're
either staying on the same hovered object *OR* (more common), we're not
hovering over anything at all.

Change the logic instead to only redraw the DOM when the tooltip moves.
Do this by computing whether or not a dom redraw is needed on every
canvas redraw. Most of the time, this will cost us ~nothing.

There's also the bonus affect now of panning correctly updating the tooltip
state when before it would stay stuck on the old state no matter how
much you panned.
@LalitMaganti LalitMaganti marked this pull request as ready for review January 17, 2026 17:41
@LalitMaganti LalitMaganti requested a review from a team as a code owner January 17, 2026 17:41
@LalitMaganti LalitMaganti requested review from stevegolton and removed request for a team January 17, 2026 17:41
@github-actions
Copy link

github-actions bot commented Jan 17, 2026

🎨 Perfetto UI Build

✅ UI build is ready: https://storage.googleapis.com/perfetto-ci-artifacts/gh-21100018595-1-ui/ui/index.html

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant