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

core(critical-requests): refactor to use lantern graph #11533

Merged
merged 22 commits into from
Oct 13, 2020
Merged

Conversation

patrickhulce
Copy link
Collaborator

Summary
Builds off the work of @connorjclark in #11410. Refactors critical request chains computed artifact to make eliminating the isCritical step much easier.

This phase should largely be a noop except eliminating a few corner cases that aren't possible with a valid graph (like a load without a network request).

Related Issues/PRs
ref #11408 (but doesn't close yet)

@patrickhulce
Copy link
Collaborator Author

@adamraine FYI I requested you too because @connorjclark wrote significant portions of this.

// By default `traverse` will discover nodes in BFS-order regardless of dependencies, but
// here we need traversal in a topological sort order. We'll visit a node only when its
// dependencies have been met.
const seenNodes = new Set();
Copy link
Collaborator

Choose a reason for hiding this comment

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

Maybe we should pull this into graph, and make a topologicalTraverse ?

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

Are you thinking there's another use for this? If we plan on using it again anywhere, sounds good :)

Copy link
Collaborator

@connorjclark connorjclark Oct 7, 2020

Choose a reason for hiding this comment

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

I don't know yet, but it does seem like a basic functionality of a graph, especially one representing nodes with logical dependencies.

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

I guess my hesitation is that this is the first time we've needed topological sort traversal in ~3 years of working with our graphs, so I'm skeptical it will come up again soon enough to justify the preemptive DRY work (and send this logic further away if we need to modify it in the next immediate step of the CRC refactor).

@@ -5587,31 +5587,31 @@
},
{
"startTime": 0,
"name": "lh:audit:redirects",
"name": "lh:computed:PageDependencyGraph",
Copy link
Collaborator Author

Choose a reason for hiding this comment

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

all that's happening here is PageDependencyGraph is moving before the others now that we request it as part of critical-request-chains

Copy link
Member

@adamraine adamraine left a comment

Choose a reason for hiding this comment

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

Overall LGTM

Co-authored-by: Adam Raine <6752989+adamraine@users.noreply.github.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

4 participants