Skip to content

Bug 2057561 - Caching derived scatter data (Fix 2) - #9750

Open
davidmiculit wants to merge 3 commits into
mozilla:masterfrom
davidmiculit:feat/2057561-fix2
Open

Bug 2057561 - Caching derived scatter data (Fix 2)#9750
davidmiculit wants to merge 3 commits into
mozilla:masterfrom
davidmiculit:feat/2057561-fix2

Conversation

@davidmiculit

@davidmiculit davidmiculit commented Aug 3, 2026

Copy link
Copy Markdown
Collaborator

Bug 2057561 - Improve frontend performance on Graphs View

The render method previously executed expensive flatMap/forEach/slice chains and O(N) array traversals on every state change, severely bottlenecking performance during graph hover and highlight events.

Fix:

  • Shifted infraAffectedData computation out of render, recalculating it only when testData or changelogData explicitly change.
  • Created an O(1) scatterPlotMap to instantly resolve hovered and locked data points, replacing expensive .find() lookups.
  • Cleaned up unused, heavy array allocations inside componentDidUpdate.

Before:
Screenshot 2026-07-31 at 12 58 42

After:
Screenshot 2026-07-31 at 13 00 19

@netlify

netlify Bot commented Aug 3, 2026

Copy link
Copy Markdown

Deploy Preview for treeherder ready!

Name Link
🔨 Latest commit 50e2091
🔍 Latest deploy log https://app.netlify.com/projects/treeherder/deploys/6a7c764d012df10008a3a6a3
😎 Deploy Preview https://deploy-preview-9750--treeherder.netlify.app
📱 Preview on mobile
Toggle QR Code...

QR Code

Use your smartphone camera to open QR code link.
🤖 Make changes Run an agent on this branch

To edit notification comments on pull requests, go to your Netlify project configuration.

Comment thread ui/perfherder/graphs/GraphsContainer.jsx Outdated
@esanuandra

Copy link
Copy Markdown
Collaborator

There could be some stale-cache bugs, waiting on confirmation for that.

if (prevProps.testData !== testData || prevProps.changelogData !== changelogData) {
this.updateGraphs();
}

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Having the changelogData verified here affects and resets the zoom if the user started using it until the changelogData request finishes.

The changelogData affects only the infraAffectedData, no need to rebuild the whole graph.

Suggested change
if (prevProps.testData !== testData) {
this.updateGraphs(); // full rebuild only when the data changes
}
if (prevProps.changelogData !== changelogData) {
this.setState((state) => ({
infraAffectedData: this.computeInfraAffectedData(state.scatterPlotData, changelogData),
})); // targeted: no zoom reset, no cache rebuild
}

};

computeInfraAffectedData = (scatterPlotData, changelogData = []) => {
let rawInfraData = [];

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
let rawInfraData = [];
const rawInfraData = [];

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.

2 participants