Skip to content

Commit f8816b0

Browse files
authored
Turbopack: Only benchmark file IO on next dev (#84474)
I added this in #66057 It's too noisy and not useful on CI. CI machines are often multi-tenant and/or running many other processes during initialization. We could check for `process.env.CI`, but I think just having the check in `next dev` is enough. https://vercel.slack.com/archives/C01A2M9R8RZ/p1759349240395449
1 parent 6f2c640 commit f8816b0

File tree

1 file changed

+23
-17
lines changed

1 file changed

+23
-17
lines changed

crates/napi/src/next_api/project.rs

Lines changed: 23 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -455,34 +455,40 @@ pub fn project_new(
455455
}
456456

457457
let options: ProjectOptions = options.into();
458+
let is_dev = options.dev;
458459
let container = turbo_tasks
459460
.run(async move {
460-
let project = ProjectContainer::new(rcstr!("next.js"), options.dev);
461+
let project = ProjectContainer::new(rcstr!("next.js"), is_dev);
461462
let project = project.to_resolved().await?;
462463
project.initialize(options).await?;
463464
Ok(project)
464465
})
465466
.or_else(|e| turbopack_ctx.throw_turbopack_internal_result(&e.into()))
466467
.await?;
467468

468-
Handle::current().spawn({
469-
let tt = turbo_tasks.clone();
470-
async move {
471-
let result = tt
472-
.clone()
473-
.run(async move {
474-
benchmark_file_io(tt, container.project().node_root().owned().await?)
469+
if is_dev {
470+
Handle::current().spawn({
471+
let tt = turbo_tasks.clone();
472+
async move {
473+
let result = tt
474+
.clone()
475+
.run(async move {
476+
benchmark_file_io(
477+
tt,
478+
container.project().node_root().owned().await?,
479+
)
475480
.await
476-
})
477-
.await;
478-
if let Err(err) = result {
479-
// TODO Not ideal to print directly to stdout.
480-
// We should use a compilation event instead to report async errors.
481-
println!("Failed to benchmark file I/O: {err}");
481+
})
482+
.await;
483+
if let Err(err) = result {
484+
// TODO Not ideal to print directly to stdout.
485+
// We should use a compilation event instead to report async errors.
486+
println!("Failed to benchmark file I/O: {err}");
487+
}
482488
}
483-
}
484-
.instrument(tracing::info_span!("benchmark file I/O"))
485-
});
489+
.instrument(tracing::info_span!("benchmark file I/O"))
490+
});
491+
}
486492

487493
Ok(External::new(ProjectInstance {
488494
turbopack_ctx,

0 commit comments

Comments
 (0)