Skip to content

chore(turbopack): Cleanup benchmark code #79943

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

Merged
merged 7 commits into from
May 30, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 1 addition & 2 deletions turbopack/crates/turbopack-cli/benches/small_apps.rs
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@

use std::{
path::{Path, PathBuf},
process::Command,

Check warning on line 7 in turbopack/crates/turbopack-cli/benches/small_apps.rs

View workflow job for this annotation

GitHub Actions / Benchmark Rust Crates (small apps)

unused import: `process::Command`
};

use criterion::{BenchmarkId, Criterion, criterion_group, criterion_main};
Expand All @@ -29,7 +29,7 @@
let path = entry.path();
if path.is_dir() {
// Exclude node_modules
if path.file_name().unwrap().to_string_lossy() == "node_modules" {
if path.file_name().unwrap_or_default() == "node_modules" {
continue;
}

Expand Down Expand Up @@ -68,7 +68,6 @@
let app_name = app.file_name().unwrap().to_string_lossy().to_string();

rt.block_on(async move {
//
turbopack_cli::build::build(&BuildArguments {
common: CommonArguments {
entries: Some(vec![format!("{app_name}/index.tsx")]),
Expand Down
2 changes: 1 addition & 1 deletion turbopack/crates/turbopack-cli/src/build/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -199,7 +199,7 @@ async fn build_internal(
target: Target,
) -> Result<Vc<()>> {
let output_fs = output_fs(project_dir.clone());
let project_fs = project_fs(root_dir.clone());
let project_fs = project_fs(root_dir.clone(), /* watch= */ false);
let project_relative = project_dir.strip_prefix(&*root_dir).unwrap();
let project_relative: RcStr = project_relative
.strip_prefix(MAIN_SEPARATOR)
Expand Down
2 changes: 1 addition & 1 deletion turbopack/crates/turbopack-cli/src/dev/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -264,7 +264,7 @@ async fn source(
.into();

let output_fs = output_fs(project_dir);
let fs: Vc<Box<dyn FileSystem>> = project_fs(root_dir);
let fs: Vc<Box<dyn FileSystem>> = project_fs(root_dir, /* watch= */ true);
let root_path = fs.root().to_resolved().await?;
let project_path = root_path.join(project_relative).to_resolved().await?;

Expand Down
4 changes: 2 additions & 2 deletions turbopack/crates/turbopack-cli/src/util.rs
Original file line number Diff line number Diff line change
Expand Up @@ -60,9 +60,9 @@ pub fn normalize_entries(entries: &Option<Vec<String>>) -> Vec<RcStr> {
}

#[turbo_tasks::function]
pub async fn project_fs(project_dir: RcStr) -> Result<Vc<Box<dyn FileSystem>>> {
pub async fn project_fs(project_dir: RcStr, watch: bool) -> Result<Vc<Box<dyn FileSystem>>> {
let disk_fs = DiskFileSystem::new("project".into(), project_dir, vec![]);
if cfg!(not(codspeed)) {
if watch {
disk_fs.await?.start_watching(None).await?;
}
Ok(Vc::upcast(disk_fs))
Expand Down
Loading