Unverified Commit 80930d68 authored by Niklas Mischkulnig's avatar Niklas Mischkulnig Committed by GitHub

Turbopack: vendor analysis benchmarks (#83178)

These files might change or move
parent a8c9d07a
# Ignore these files in tools like grep, rg, ast-grep, etc. These files should # Ignore these files in tools like grep, rg, ast-grep, etc. These files should
# *not* be ignored by git. # *not* be ignored by git.
packages/next/src/compiled
turbopack/crates/turbopack-ecmascript/tests/benches/*
# Not valid text # Not valid text
turbopack/crates/turbopack-tests/tests/execution/turbopack/basic/error/input/broken.js turbopack/crates/turbopack-tests/tests/execution/turbopack/basic/error/input/broken.js
packages/next/src/compiled
...@@ -60,6 +60,7 @@ test/e2e/async-modules/amp-validator-wasm.js ...@@ -60,6 +60,7 @@ test/e2e/async-modules/amp-validator-wasm.js
/turbopack/crates/*/js/src/compiled /turbopack/crates/*/js/src/compiled
/turbopack/crates/turbopack/bench.json /turbopack/crates/turbopack/bench.json
/turbopack/crates/turbopack-ecmascript/tests/analyzer/graph /turbopack/crates/turbopack-ecmascript/tests/analyzer/graph
/turbopack/crates/turbopack-ecmascript/tests/benches
/turbopack/crates/turbopack-ecmascript/tests/tree-shaker /turbopack/crates/turbopack-ecmascript/tests/tree-shaker
/turbopack/crates/next-transform-strip-page-exports/tests /turbopack/crates/next-transform-strip-page-exports/tests
/turbopack/crates/next-transform-dynamic/tests /turbopack/crates/next-transform-dynamic/tests
...@@ -86,4 +87,4 @@ test/production/app-dir/symbolic-file-links/src/app/page.tsx ...@@ -86,4 +87,4 @@ test/production/app-dir/symbolic-file-links/src/app/page.tsx
turbopack/crates/turbopack/tests/node-file-trace/integration/pnpm/node_modules/foo turbopack/crates/turbopack/tests/node-file-trace/integration/pnpm/node_modules/foo
turbopack/crates/turbopack/tests/node-file-trace/integration/pnpm/node_modules/.pnpm/foo@2.1.0/node_modules/lodash-pnpm-test turbopack/crates/turbopack/tests/node-file-trace/integration/pnpm/node_modules/.pnpm/foo@2.1.0/node_modules/lodash-pnpm-test
turbopack/crates/turbopack/tests/node-file-trace/integration/symlink-to-file/linked.js turbopack/crates/turbopack/tests/node-file-trace/integration/symlink-to-file/linked.js
turbopack/crates/turbopack-tests/tests/snapshot/swc_transforms/mono_transforms/input/node_modules/component turbopack/crates/turbopack-tests/tests/snapshot/swc_transforms/mono_transforms/input/node_modules/component
\ No newline at end of file
...@@ -38,7 +38,7 @@ pub fn benchmark(c: &mut Criterion) { ...@@ -38,7 +38,7 @@ pub fn benchmark(c: &mut Criterion) {
let cases = rt let cases = rt
.block_on(tt.run_once(async { .block_on(tt.run_once(async {
let root_dir = PathBuf::from(env!("CARGO_MANIFEST_DIR")).join("../../../"); let root_dir = PathBuf::from(env!("CARGO_MANIFEST_DIR")).join("tests/benches/");
let fs = DiskFileSystem::new(rcstr!("project"), root_dir.to_str().unwrap().into()); let fs = DiskFileSystem::new(rcstr!("project"), root_dir.to_str().unwrap().into());
let environment = Environment::new(ExecutionEnvironment::NodeJsLambda( let environment = Environment::new(ExecutionEnvironment::NodeJsLambda(
...@@ -54,10 +54,12 @@ pub fn benchmark(c: &mut Criterion) { ...@@ -54,10 +54,12 @@ pub fn benchmark(c: &mut Criterion) {
let mut cases = vec![]; let mut cases = vec![];
for (file, is_tracing) in [ for (file, is_tracing) in [
(r#"packages/next/dist/compiled/babel-packages/packages-bundle.js"#, false), (r#"packages-bundle.js"#, false),
(r#"packages/next/dist/compiled/babel-packages/packages-bundle.js"#, true), (r#"packages-bundle.js"#, true),
(r#"node_modules/.pnpm/react-dom@19.2.0-canary-03fda05d-20250820_react@19.2.0-canary-03fda05d-20250820/node_modules/react-dom/cjs/react-dom-client.development.js"#, false), (r#"app-page-turbo.runtime.prod.js"#, false),
(r#"node_modules/.pnpm/react-dom@19.2.0-canary-03fda05d-20250820_react@19.2.0-canary-03fda05d-20250820/node_modules/react-dom/cjs/react-dom-client.development.js"#, true), (r#"app-page-turbo.runtime.prod.js"#, true),
(r#"react-dom-client.development.js"#, false),
(r#"react-dom-client.development.js"#, true),
] { ] {
let module = EcmascriptModuleAsset::builder( let module = EcmascriptModuleAsset::builder(
ResolvedVc::upcast( ResolvedVc::upcast(
...@@ -79,7 +81,11 @@ pub fn benchmark(c: &mut Criterion) { ...@@ -79,7 +81,11 @@ pub fn benchmark(c: &mut Criterion) {
.to_resolved() .to_resolved()
.await?; .await?;
cases.push((file.rsplit("/").next().unwrap(), if is_tracing { "tracing" } else { "full" }, module)); cases.push((
file.rsplit("/").next().unwrap(),
if is_tracing { "tracing" } else { "full" },
module,
));
} }
anyhow::Ok(cases) anyhow::Ok(cases)
})) }))
...@@ -117,9 +123,11 @@ where ...@@ -117,9 +123,11 @@ where
.build() .build()
.unwrap(); .unwrap();
b.to_async(rt).iter(|| { b.to_async(rt).iter(async || {
input input
.storage .storage
.run_once(analyse_ecmascript_module_internal(input.module, None)) .run_once(analyse_ecmascript_module_internal(input.module, None))
.await
.unwrap()
}); });
} }
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