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

perf: reduce some clones and pre-allocate some collections #215

Merged
merged 3 commits into from
Feb 7, 2023

Conversation

dsherret
Copy link
Member

@dsherret dsherret commented Feb 6, 2023

No description provided.

@dsherret dsherret requested a review from bartlomieju February 6, 2023 23:46
for root in &self.roots {
validate(root, None, types_only, false, &mut seen, &|s| {
self.try_get(s).map(|o| o.cloned())
Copy link
Member Author

Choose a reason for hiding this comment

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

This seemed heavy.

src/graph.rs Outdated
@@ -769,15 +769,16 @@ impl ModuleGraph {
/// returning the "final" module.
pub fn resolve(&self, specifier: &ModuleSpecifier) -> ModuleSpecifier {
let mut redirected_specifier = specifier;
let mut seen = HashSet::new();
let max_redirects = 6;
Copy link
Member

Choose a reason for hiding this comment

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

Does this match the number of allowed redirects in CLI file fetcher?

Copy link
Member Author

Choose a reason for hiding this comment

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

That is 10, I will increase this

Copy link
Member

@bartlomieju bartlomieju left a comment

Choose a reason for hiding this comment

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

LGTM. Thinking about this max redirect count mismatch, I'm wondering if FileFetcher in Deno should be a crate...

@dsherret
Copy link
Member Author

dsherret commented Feb 7, 2023

The redirects here are just a module graph thing so the code couldn’t be shared.

@dsherret dsherret merged commit cc95ff1 into denoland:main Feb 7, 2023
@dsherret dsherret deleted the reduce_cloning branch February 7, 2023 00:28
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