Unverified Commit edd09733 authored by Donny/강동윤's avatar Donny/강동윤 Committed by GitHub

chore(turbopack): Cleanup benchmark code (#79943)

### What?

Cleanup code for benchmarking

### Why?


https://github.com/vercel/next.js/pull/79796#pullrequestreview-2879675461

---------
Co-authored-by: 's avatarLuke Sandberg <lukesandberg@users.noreply.github.com>
parent 0084361f
......@@ -29,7 +29,7 @@ fn list_apps() -> (PathBuf, Vec<PathBuf>) {
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;
}
......@@ -68,7 +68,6 @@ fn bench_small_apps(c: &mut Criterion) {
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")]),
......
......@@ -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)
......
......@@ -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?;
......
......@@ -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))
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment