Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Move asset selection filtering to webworker #26315

Merged
merged 9 commits into from
Dec 9, 2024

Conversation

salazarm
Copy link
Contributor

@salazarm salazarm commented Dec 6, 2024

Summary & Motivation

Move our heavy asset selection filtering to a webworker. Added a feature flag as an escape hatch.

How I Tested These Changes

Tested primarily with cloud-proxy with customers that have large graphs.

// Returns `false` if `filterArray` is non-empty and `valueArray` is empty (no matches possible).
// Otherwise, checks if all elements in `filterArray` have at least one corresponding match in `valueArray`.
// Uses `Array.prototype.some()` to verify if any `filterArray` element lacks a match and returns `false` in such cases.
export function doesFilterArrayMatchValueArray<T, V>(
Copy link
Contributor Author

Choose a reason for hiding this comment

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

Moved this to a separate file so that the webworker doesnt end up pulling React.

@@ -94,23 +93,6 @@ export function useTagsForObjects<T>(
);
}

export function doesFilterArrayMatchValueArray<T, V>(
Copy link
Contributor Author

Choose a reason for hiding this comment

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

Moved this to a separate file so that the webworker doesnt end up pulling React.

Copy link

github-actions bot commented Dec 6, 2024

Deploy preview for dagit-core-storybook ready!

✅ Preview
https://dagit-core-storybook-khafd6le2-elementl.vercel.app
https://salazarm-perf-improvements.core-storybook.dagster-docs.io

Built with commit 057a43d.
This pull request is being automatically deployed with vercel-action

Copy link
Collaborator

@bengotow bengotow left a comment

Choose a reason for hiding this comment

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

This looks great! Just left a few inline comments

@@ -225,7 +225,7 @@ export const AssetsCatalogTable = ({

const refreshState = useRefreshAtInterval({
refresh: query,
intervalMs: FIFTEEN_SECONDS,
intervalMs: 4 * FIFTEEN_SECONDS,
Copy link
Collaborator

Choose a reason for hiding this comment

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

This seems fairly impactful, are we ok with backing this off so much? It should already be slowing down if refresh takes a while, there's some fanciness inside this hook

Copy link
Contributor Author

@salazarm salazarm Dec 7, 2024

Choose a reason for hiding this comment

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

This still fires immediately if they leave tabs and come back or hit the refresh button in the top right corner.

localStorage.setItem(DAGSTER_FLAGS_KEY, JSON.stringify(flags));
if (broadcast) {
featureFlagsChannel.postMessage('updated');
if (typeof localStorage !== 'undefined') {
Copy link
Collaborator

Choose a reason for hiding this comment

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

Might be nice to call out that this is for the webworker case just so we don't forget 😬

@salazarm salazarm force-pushed the salazarm/perf-improvements branch from fd82ec0 to 16de3e2 Compare December 6, 2024 22:32
@salazarm salazarm force-pushed the salazarm/perf-improvements branch from 31f8f50 to 28b99af Compare December 9, 2024 18:09
@salazarm salazarm merged commit b0bcb20 into master Dec 9, 2024
1 of 2 checks passed
@salazarm salazarm deleted the salazarm/perf-improvements branch December 9, 2024 18:31
salazarm added a commit that referenced this pull request Dec 9, 2024
Move our heavy asset selection filtering to a webworker. Added a feature
flag as an escape hatch.

Tested primarily with cloud-proxy with customers that have large graphs.
salazarm added a commit that referenced this pull request Dec 10, 2024
Similar to #26315, moves
`buildGraphData` for the `useFullAssetGraphData` hook into a webworker.


## Test plan

Tested using app-proxy and loading a big asset graph
pskinnerthyme pushed a commit to pskinnerthyme/dagster that referenced this pull request Dec 16, 2024
## Summary & Motivation

Move our heavy asset selection filtering to a webworker. Added a feature
flag as an escape hatch.

## How I Tested These Changes

Tested primarily with cloud-proxy with customers that have large graphs.
pskinnerthyme pushed a commit to pskinnerthyme/dagster that referenced this pull request Dec 16, 2024
Similar to dagster-io#26315, moves
`buildGraphData` for the `useFullAssetGraphData` hook into a webworker.


## Test plan

Tested using app-proxy and loading a big asset graph
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.

3 participants