diff --git a/.gitignore b/.gitignore index 77ef54c8..643b31f0 100644 --- a/.gitignore +++ b/.gitignore @@ -82,3 +82,10 @@ bin/ build/ dist/ site/ +mock_heavy_project/ +mock_project/ +mock_project_fast/ +run_bench.sh +run_heavy_bench.sh +mock_many_imports/ +run_many_imports.sh diff --git a/cli/src/project.rs b/cli/src/project.rs index 8b15e1c7..32254841 100644 --- a/cli/src/project.rs +++ b/cli/src/project.rs @@ -163,6 +163,7 @@ impl ProjectBuildGraph { // 2. Resolve imports recursively let mut visited = HashSet::new(); + let mut manifest_cache: HashMap = HashMap::new(); while let Some((fid, path, pkg_name)) = to_resolve.pop() { if visited.contains(&fid) { continue; @@ -256,14 +257,18 @@ impl ProjectBuildGraph { } if !try_file.exists() { let manifest_toml = pkg_path.join("tech.toml"); - if manifest_toml.exists() { + if let Some(cached_entry) = manifest_cache.get(&manifest_toml) { + try_file = pkg_path.join(cached_entry); + } else if manifest_toml.exists() { if let Ok(toml_content) = std::fs::read_to_string(&manifest_toml) { if let Ok(manifest) = toml::from_str::( &toml_content, ) { - try_file = pkg_path.join(manifest.package.entry); + let entry = manifest.package.entry; + try_file = pkg_path.join(&entry); + manifest_cache.insert(manifest_toml, entry); } } }