File tree Expand file tree Collapse file tree 4 files changed +32
-5
lines changed
turbopack/crates/turbopack-cli Expand file tree Collapse file tree 4 files changed +32
-5
lines changed Original file line number Diff line number Diff line change @@ -254,6 +254,10 @@ inherits = "release"
254
254
debug-assertions = true
255
255
overflow-checks = true
256
256
257
+ [profile .release-with-debug ]
258
+ inherits = " release"
259
+ debug = true
260
+
257
261
[workspace .dependencies ]
258
262
# Workspace crates
259
263
next-api = { path = " crates/next-api" }
Original file line number Diff line number Diff line change @@ -74,6 +74,7 @@ fn bench_small_apps(c: &mut Criterion) {
74
74
log_detail : false ,
75
75
full_stats : false ,
76
76
target : None ,
77
+ worker_threads : None ,
77
78
} ,
78
79
no_sourcemap : false ,
79
80
no_minify : false ,
Original file line number Diff line number Diff line change @@ -25,6 +25,14 @@ impl Arguments {
25
25
Arguments :: Dev ( args) => args. common . dir . as_deref ( ) ,
26
26
}
27
27
}
28
+
29
+ /// The number of worker threads to use. see [CommonArguments]::worker_threads
30
+ pub fn worker_threads ( & self ) -> Option < usize > {
31
+ match self {
32
+ Arguments :: Build ( args) => args. common . worker_threads ,
33
+ Arguments :: Dev ( args) => args. common . worker_threads ,
34
+ }
35
+ }
28
36
}
29
37
30
38
#[ derive(
@@ -80,13 +88,17 @@ pub struct CommonArguments {
80
88
#[ clap( long) ]
81
89
pub full_stats : bool ,
82
90
91
+ /// Whether to build for the `browser` or `node`
92
+ #[ clap( long) ]
93
+ pub target : Option < Target > ,
94
+
95
+ /// Number of worker threads to use for parallel processing
96
+ #[ clap( long) ]
97
+ pub worker_threads : Option < usize > ,
83
98
// Enable experimental garbage collection with the provided memory limit in
84
99
// MB.
85
100
// #[clap(long)]
86
101
// pub memory_limit: Option<usize>,
87
- /// Whether to build for the `browser` or `node``
88
- #[ clap( long) ]
89
- pub target : Option < Target > ,
90
102
}
91
103
92
104
#[ derive( Debug , Args ) ]
Original file line number Diff line number Diff line change @@ -42,15 +42,25 @@ fn main() {
42
42
} ) ;
43
43
} ) ;
44
44
45
- let worker_threads = available_parallelism ( ) . map ( |n| n. get ( ) ) . unwrap_or ( 1 ) ;
45
+ let args = Arguments :: parse ( ) ;
46
+
47
+ let worker_threads = args
48
+ . worker_threads ( )
49
+ . map ( |v| {
50
+ if v == 0 {
51
+ panic ! ( "--worker-threads=0 is invalid, you must use at least one thread." ) ;
52
+ } else {
53
+ v
54
+ }
55
+ } )
56
+ . unwrap_or_else ( || available_parallelism ( ) . map ( |n| n. get ( ) ) . unwrap_or ( 1 ) ) ;
46
57
47
58
rt. worker_threads ( worker_threads) ;
48
59
rt. max_blocking_threads ( usize:: MAX - worker_threads) ;
49
60
50
61
#[ cfg( not( codspeed) ) ]
51
62
rt. disable_lifo_slot ( ) ;
52
63
53
- let args = Arguments :: parse ( ) ;
54
64
rt. build ( ) . unwrap ( ) . block_on ( main_inner ( args) ) . unwrap ( ) ;
55
65
}
56
66
You can’t perform that action at this time.
0 commit comments