Skip to content

Commit f4fc1a6

Browse files
authored
Revert "perf(turbopack): Use rayon threadpool for minify()" (vercel#79296)
Reverts vercel#79261 because it regressed RSS
1 parent e0c2e2a commit f4fc1a6

File tree

6 files changed

+6
-19
lines changed

6 files changed

+6
-19
lines changed

Cargo.lock

Lines changed: 0 additions & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

turbopack/crates/turbopack-browser/src/ecmascript/content.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -128,7 +128,7 @@ impl EcmascriptBrowserChunkContent {
128128
let mut code = code.build();
129129

130130
if let MinifyType::Minify { mangle } = this.chunking_context.await?.minify_type() {
131-
code = minify(code, source_maps, mangle).await?;
131+
code = minify(&code, source_maps, mangle)?;
132132
}
133133

134134
Ok(code.cell())

turbopack/crates/turbopack-browser/src/ecmascript/evaluate/chunk.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -194,7 +194,7 @@ impl EcmascriptBrowserEvaluateChunk {
194194
let mut code = code.build();
195195

196196
if let MinifyType::Minify { mangle } = this.chunking_context.await?.minify_type() {
197-
code = minify(code, source_maps, mangle).await?;
197+
code = minify(&code, source_maps, mangle)?;
198198
}
199199

200200
Ok(code.cell())

turbopack/crates/turbopack-ecmascript/Cargo.toml

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -44,7 +44,6 @@ turbopack-resolve = { workspace = true }
4444
turbopack-swc-utils = { workspace = true }
4545
url = { workspace = true }
4646
urlencoding = { workspace = true }
47-
rayon = { workspace = true }
4847

4948
swc_core = { workspace = true, features = [
5049
"ecma_ast",

turbopack/crates/turbopack-ecmascript/src/minify.rs

Lines changed: 3 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -31,18 +31,7 @@ use turbopack_core::{
3131
use crate::parse::generate_js_source_map;
3232

3333
#[instrument(level = Level::INFO, skip_all)]
34-
pub async fn minify(code: Code, source_maps: bool, mangle: Option<MangleType>) -> Result<Code> {
35-
let (tx, rx) = tokio::sync::oneshot::channel();
36-
37-
rayon::spawn(move || {
38-
let result = minify_inner(code, source_maps, mangle);
39-
tx.send(result).unwrap();
40-
});
41-
42-
rx.await.unwrap()
43-
}
44-
45-
fn minify_inner(code: Code, source_maps: bool, mangle: Option<MangleType>) -> Result<Code> {
34+
pub fn minify(code: &Code, source_maps: bool, mangle: Option<MangleType>) -> Result<Code> {
4635
let source_maps = source_maps
4736
.then(|| code.generate_source_map_ref())
4837
.transpose()?;
@@ -150,8 +139,8 @@ fn minify_inner(code: Code, source_maps: bool, mangle: Option<MangleType>) -> Re
150139
src_map_buf,
151140
Some(original_map),
152141
// We do not inline source contents.
153-
// We provide a synthesized value to `cm.new_source_file` above, so it cannot
154-
// be the value user expect anyway.
142+
// We provide a synthesized value to `cm.new_source_file` above, so it cannot be
143+
// the value user expect anyway.
155144
false,
156145
)?),
157146
);

turbopack/crates/turbopack-nodejs/src/ecmascript/node/content.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -78,7 +78,7 @@ impl EcmascriptBuildNodeChunkContent {
7878
let mut code = code.build();
7979

8080
if let MinifyType::Minify { mangle } = this.chunking_context.await?.minify_type() {
81-
code = minify(code, source_maps, mangle).await?;
81+
code = minify(&code, source_maps, mangle)?;
8282
}
8383

8484
Ok(code.cell())

0 commit comments

Comments
 (0)