Skip to content
Projects
Groups
Snippets
Help
Loading...
Sign in
Toggle navigation
N
next.js
Project
Project
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Alex
next.js
Commits
640d7bc5
Unverified
Commit
640d7bc5
authored
Oct 07, 2025
by
Niklas Mischkulnig
Committed by
GitHub
Oct 07, 2025
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Turbopack: add manual worker count override (#84454)
parent
0f781a6a
Show whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
32 additions
and
5 deletions
+32
-5
Cargo.toml
Cargo.toml
+4
-0
small_apps.rs
turbopack/crates/turbopack-cli/benches/small_apps.rs
+1
-0
arguments.rs
turbopack/crates/turbopack-cli/src/arguments.rs
+15
-3
main.rs
turbopack/crates/turbopack-cli/src/main.rs
+12
-2
No files found.
Cargo.toml
View file @
640d7bc5
...
@@ -254,6 +254,10 @@ inherits = "release"
...
@@ -254,6 +254,10 @@ inherits = "release"
debug-assertions
=
true
debug-assertions
=
true
overflow-checks
=
true
overflow-checks
=
true
[profile.release-with-debug]
inherits
=
"release"
debug
=
true
[workspace.dependencies]
[workspace.dependencies]
# Workspace crates
# Workspace crates
next-api
=
{
path
=
"crates/next-api"
}
next-api
=
{
path
=
"crates/next-api"
}
...
...
turbopack/crates/turbopack-cli/benches/small_apps.rs
View file @
640d7bc5
...
@@ -74,6 +74,7 @@ fn bench_small_apps(c: &mut Criterion) {
...
@@ -74,6 +74,7 @@ fn bench_small_apps(c: &mut Criterion) {
log_detail
:
false
,
log_detail
:
false
,
full_stats
:
false
,
full_stats
:
false
,
target
:
None
,
target
:
None
,
worker_threads
:
None
,
},
},
no_sourcemap
:
false
,
no_sourcemap
:
false
,
no_minify
:
false
,
no_minify
:
false
,
...
...
turbopack/crates/turbopack-cli/src/arguments.rs
View file @
640d7bc5
...
@@ -25,6 +25,14 @@ impl Arguments {
...
@@ -25,6 +25,14 @@ impl Arguments {
Arguments
::
Dev
(
args
)
=>
args
.common.dir
.as_deref
(),
Arguments
::
Dev
(
args
)
=>
args
.common.dir
.as_deref
(),
}
}
}
}
/// The number of worker threads to use. see [CommonArguments]::worker_threads
pub
fn
worker_threads
(
&
self
)
->
Option
<
usize
>
{
match
self
{
Arguments
::
Build
(
args
)
=>
args
.common.worker_threads
,
Arguments
::
Dev
(
args
)
=>
args
.common.worker_threads
,
}
}
}
}
#[derive(
#[derive(
...
@@ -80,13 +88,17 @@ pub struct CommonArguments {
...
@@ -80,13 +88,17 @@ pub struct CommonArguments {
#[clap(long)]
#[clap(long)]
pub
full_stats
:
bool
,
pub
full_stats
:
bool
,
/// Whether to build for the `browser` or `node`
#[clap(long)]
pub
target
:
Option
<
Target
>
,
/// Number of worker threads to use for parallel processing
#[clap(long)]
pub
worker_threads
:
Option
<
usize
>
,
// Enable experimental garbage collection with the provided memory limit in
// Enable experimental garbage collection with the provided memory limit in
// MB.
// MB.
// #[clap(long)]
// #[clap(long)]
// pub memory_limit: Option<usize>,
// pub memory_limit: Option<usize>,
/// Whether to build for the `browser` or `node``
#[clap(long)]
pub
target
:
Option
<
Target
>
,
}
}
#[derive(Debug,
Args)]
#[derive(Debug,
Args)]
...
...
turbopack/crates/turbopack-cli/src/main.rs
View file @
640d7bc5
...
@@ -42,7 +42,18 @@ fn main() {
...
@@ -42,7 +42,18 @@ fn main() {
});
});
});
});
let
worker_threads
=
available_parallelism
()
.map
(|
n
|
n
.get
())
.unwrap_or
(
1
);
let
args
=
Arguments
::
parse
();
let
worker_threads
=
args
.worker_threads
()
.map
(|
v
|
{
if
v
==
0
{
panic!
(
"--worker-threads=0 is invalid, you must use at least one thread."
);
}
else
{
v
}
})
.unwrap_or_else
(||
available_parallelism
()
.map
(|
n
|
n
.get
())
.unwrap_or
(
1
));
rt
.worker_threads
(
worker_threads
);
rt
.worker_threads
(
worker_threads
);
rt
.max_blocking_threads
(
usize
::
MAX
-
worker_threads
);
rt
.max_blocking_threads
(
usize
::
MAX
-
worker_threads
);
...
@@ -50,7 +61,6 @@ fn main() {
...
@@ -50,7 +61,6 @@ fn main() {
#[cfg(not(codspeed))]
#[cfg(not(codspeed))]
rt
.disable_lifo_slot
();
rt
.disable_lifo_slot
();
let
args
=
Arguments
::
parse
();
rt
.build
()
.unwrap
()
.block_on
(
main_inner
(
args
))
.unwrap
();
rt
.build
()
.unwrap
()
.block_on
(
main_inner
(
args
))
.unwrap
();
}
}
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment