8000 chore(ci): Make turbopack benchmark less flaky by kdy1 · Pull Request #79980 · vercel/next.js · GitHub
[go: up one dir, main page]

Skip to content

chore(ci): Make turbopack benchmark less flaky #79980

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 5 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
1 change: 1 addition & 0 deletions Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

75 changes: 40 additions & 35 deletions turbopack/crates/turbopack-cli/benches/small_apps.rs
Original file line number Diff line number Diff line change
@@ -1,11 +1,13 @@
#![cfg_attr(not(codspeed), allow(unused))]

extern crate turbo_tasks_malloc;

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::{Criterion, criterion_group, criterion_main};
use criterion::{BenchmarkId, Criterion, criterion_group, criterion_main};
use turbopack_cli::{
arguments::{BuildArguments, CommonArguments},
register,
Expand Down Expand Up @@ -47,44 +49,47 @@
let mut g = c.benchmark_group("turbopack/build/apps");

for app in apps {
g.bench_function(app.to_string_lossy().to_string(), |b| {
let apps_dir = apps_dir.clone();
let app = app.clone();

b.iter(move || {
let mut rt = tokio::runtime::Builder::new_multi_thread();
rt.enable_all().on_thread_stop(|| {
TurboMalloc::thread_stop();
});
let rt = rt.build().unwrap();

g.bench_function(
BenchmarkId::new("build", app.file_name().unwrap().to_string_lossy()),
|b| {
let apps_dir = apps_dir.clone();
let app = app.clone();

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")]),
dir: Some(app.clone()),
root: Some(apps_dir),
log_level: None,
show_all: false,
log_detail: false,
full_stats: false,
target: None,
},
no_sourcemap: false,
no_minify: false,
force_memory_cleanup: true,
b.iter(move || {
let mut rt = tokio::runtime::Builder::new_multi_thread();
rt.enable_all().on_thread_stop(|| {
TurboMalloc::thread_stop();
});
let rt = rt.build().unwrap();

let apps_dir = apps_dir.clone();
let app = app.clone();

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")]),
dir: Some(app.clone()),
root: Some(apps_dir),
log_level: None,
show_all: false,
log_detail: false,
full_stats: false,
target: None,
},
no_sourcemap: false,
no_minify: false,
force_memory_cleanup: true,
})
.await
})
.await
})
.unwrap();
});
});
.unwrap();
});
},
);
}
}

Expand Down
1 change: 1 addition & 0 deletions turbopack/crates/turbopack-ecmascript/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -77,6 +77,7 @@ par-core = { workspace = true, features = ["rayon"] }
[dev-dependencies]
criterion = { workspace = true, features = ["async_tokio"] }
turbo-tasks-backend = { workspace = true }
turbo-tasks-malloc = { workspace = true }
turbo-tasks-testing = { workspace = true }

[build-dependencies]
Expand Down
2 changes: 2 additions & 0 deletions turbopack/crates/turbopack-ecmascript/benches/mod.rs
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
extern crate turbo_tasks_malloc;

use criterion::{criterion_group, criterion_main};

mod analyzer;
Expand Down
Loading
0