Skip to content

Commit edd0973

Browse files
kdy1lukesandberg
andauthored
chore(turbopack): Cleanup benchmark code (#79943)
### What? Cleanup code for benchmarking ### Why? #79796 (review) --------- Co-authored-by: Luke Sandberg <[email protected]>
1 parent 0084361 commit edd0973

File tree

4 files changed

+5
-6
lines changed

4 files changed

+5
-6
lines changed

turbopack/crates/turbopack-cli/benches/small_apps.rs

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,7 @@ fn list_apps() -> (PathBuf, Vec<PathBuf>) {
2929
let path = entry.path();
3030
if path.is_dir() {
3131
// Exclude node_modules
32-
if path.file_name().unwrap().to_string_lossy() == "node_modules" {
32+
if path.file_name().unwrap_or_default() == "node_modules" {
3333
continue;
3434
}
3535

@@ -68,7 +68,6 @@ fn bench_small_apps(c: &mut Criterion) {
6868
let app_name = app.file_name().unwrap().to_string_lossy().to_string();
6969

7070
rt.block_on(async move {
71-
//
7271
turbopack_cli::build::build(&BuildArguments {
7372
common: CommonArguments {
7473
entries: Some(vec![format!("{app_name}/index.tsx")]),

turbopack/crates/turbopack-cli/src/build/mod.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -199,7 +199,7 @@ async fn build_internal(
199199
target: Target,
200200
) -> Result<Vc<()>> {
201201
let output_fs = output_fs(project_dir.clone());
202-
let project_fs = project_fs(root_dir.clone());
202+
let project_fs = project_fs(root_dir.clone(), /* watch= */ false);
203203
let project_relative = project_dir.strip_prefix(&*root_dir).unwrap();
204204
let project_relative: RcStr = project_relative
205205
.strip_prefix(MAIN_SEPARATOR)

turbopack/crates/turbopack-cli/src/dev/mod.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -264,7 +264,7 @@ async fn source(
264264
.into();
265265

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

turbopack/crates/turbopack-cli/src/util.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -60,9 +60,9 @@ pub fn normalize_entries(entries: &Option<Vec<String>>) -> Vec<RcStr> {
6060
}
6161

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

0 commit comments

Comments
 (0)