Skip to content

[Deploy] Fast activity graph drawing#5888

Draft
mstange wants to merge 23 commits intofirefox-devtools:mainfrom
mstange:push-qlrqwlskoyom
Draft

[Deploy] Fast activity graph drawing#5888
mstange wants to merge 23 commits intofirefox-devtools:mainfrom
mstange:push-qlrqwlskoyom

Conversation

@mstange
Copy link
Contributor

@mstange mstange commented Mar 7, 2026

Production | Deploy preview

On my machine, when I press and hold the up/down keys on this profile, these changes reduce the time of each keydown event from 130ms to 23ms (~6x faster). https://share.firefox.dev/4d8gja7

@mstange mstange force-pushed the push-qlrqwlskoyom branch 2 times, most recently from 7edd29c to 6781a87 Compare March 7, 2026 22:52
@codecov
Copy link

codecov bot commented Mar 7, 2026

Codecov Report

❌ Patch coverage is 97.09091% with 8 lines in your changes missing coverage. Please review.
✅ Project coverage is 85.43%. Comparing base (8f73bab) to head (6a88829).
⚠️ Report is 1 commits behind head on main.

Files with missing lines Patch % Lines
...rc/components/shared/thread/ActivityGraphFills.tsx 97.65% 3 Missing ⚠️
src/profile-logic/profile-data.ts 97.56% 1 Missing and 1 partial ⚠️
src/components/flame-graph/Canvas.tsx 83.33% 1 Missing ⚠️
src/components/shared/thread/HeightGraph.tsx 85.71% 1 Missing ⚠️
src/components/tooltip/CallNode.tsx 66.66% 1 Missing ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##             main    #5888      +/-   ##
==========================================
+ Coverage   85.41%   85.43%   +0.02%     
==========================================
  Files         321      322       +1     
  Lines       32140    32187      +47     
  Branches     8757     8764       +7     
==========================================
+ Hits        27451    27498      +47     
+ Misses       4257     4256       -1     
- Partials      432      433       +1     

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

@mstange mstange force-pushed the push-qlrqwlskoyom branch from 6781a87 to 7ae0cc9 Compare March 9, 2026 15:01
mstange added 23 commits March 9, 2026 11:02
 
This turns it into a Uint8Array of integer percentages,
which requires less memory bandwidth when rendering the
activity graph.

We now always have a fallback threadCPUPercent array, even
if the original profile doesn't contain any threadCPUDelta
information. The synthesized values are set to 100%.

We also have a trailing extra value in order to simplify the
rendering code for the last sample.
The UI for switching the activity graph type isn't visible
by default and nobody has complained about its absence.
I think there's still a way to use the URL to ask for an
activity graph that doesn't take CPU usage into account,
but we can just start ignoring that URL parameter.

This simplifies the code.
Nothing was passing null here.
…dSelf" and "TotalButNotSelf" states.

This will let us share work between the activity graph and the sidebar,
see the next commit.

There's unfortunately a bit of the clash between the variable names and the types now.

Should we rename sampleSelectedStates to sampleRelationsToSelectedNode everywhere?
It sounds a bit clunky.
Sadly this gives a big performance boost in Firefox.
…ons.

When computing the activity graph fills, store the fractional sample
positions as integers after multipyling by (1 << FIXED_PREC_BITS).
This lets us use shifts and masking when we accumulate the contributions
into the buffers in the hot loops.
@mstange mstange force-pushed the push-qlrqwlskoyom branch from 7ae0cc9 to 6a88829 Compare March 9, 2026 15:02
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