Unverified Commit f4fc1a64 authored by Donny/강동윤's avatar Donny/강동윤 Committed by GitHub

Revert "perf(turbopack): Use rayon threadpool for `minify()`" (#79296)

Reverts vercel/next.js#79261 because it regressed RSS
parent e0c2e2ae
......@@ -10162,7 +10162,6 @@ dependencies = [
"par-core",
"parking_lot",
"petgraph 0.6.3",
"rayon",
"regex",
"rustc-hash 2.1.1",
"serde",
......
......@@ -128,7 +128,7 @@ impl EcmascriptBrowserChunkContent {
let mut code = code.build();
if let MinifyType::Minify { mangle } = this.chunking_context.await?.minify_type() {
code = minify(code, source_maps, mangle).await?;
code = minify(&code, source_maps, mangle)?;
}
Ok(code.cell())
......
......@@ -194,7 +194,7 @@ impl EcmascriptBrowserEvaluateChunk {
let mut code = code.build();
if let MinifyType::Minify { mangle } = this.chunking_context.await?.minify_type() {
code = minify(code, source_maps, mangle).await?;
code = minify(&code, source_maps, mangle)?;
}
Ok(code.cell())
......
......@@ -44,7 +44,6 @@ turbopack-resolve = { workspace = true }
turbopack-swc-utils = { workspace = true }
url = { workspace = true }
urlencoding = { workspace = true }
rayon = { workspace = true }
swc_core = { workspace = true, features = [
"ecma_ast",
......
......@@ -31,18 +31,7 @@ use turbopack_core::{
use crate::parse::generate_js_source_map;
#[instrument(level = Level::INFO, skip_all)]
pub async fn minify(code: Code, source_maps: bool, mangle: Option<MangleType>) -> Result<Code> {
let (tx, rx) = tokio::sync::oneshot::channel();
rayon::spawn(move || {
let result = minify_inner(code, source_maps, mangle);
tx.send(result).unwrap();
});
rx.await.unwrap()
}
fn minify_inner(code: Code, source_maps: bool, mangle: Option<MangleType>) -> Result<Code> {
pub fn minify(code: &Code, source_maps: bool, mangle: Option<MangleType>) -> Result<Code> {
let source_maps = source_maps
.then(|| code.generate_source_map_ref())
.transpose()?;
......@@ -150,8 +139,8 @@ fn minify_inner(code: Code, source_maps: bool, mangle: Option<MangleType>) -> Re
src_map_buf,
Some(original_map),
// We do not inline source contents.
// We provide a synthesized value to `cm.new_source_file` above, so it cannot
// be the value user expect anyway.
// We provide a synthesized value to `cm.new_source_file` above, so it cannot be
// the value user expect anyway.
false,
)?),
);
......
......@@ -78,7 +78,7 @@ impl EcmascriptBuildNodeChunkContent {
let mut code = code.build();
if let MinifyType::Minify { mangle } = this.chunking_context.await?.minify_type() {
code = minify(code, source_maps, mangle).await?;
code = minify(&code, source_maps, mangle)?;
}
Ok(code.cell())
......
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