Unverified Commit 7633c673 authored by Tobias Koppers's avatar Tobias Koppers Committed by GitHub

[Turbopack] smarter merging of small chunks in production chunking (#76319)

### What?

Instead of merging the smallest chunks to get over the min chunk size, choose chunks with the biggest overlap in chunk groups to merge.
This makes it more likely to have these merged chunks to be shared between chunk groups.
parent 7085190f
...@@ -30,7 +30,7 @@ use crate::{ ...@@ -30,7 +30,7 @@ use crate::{
#[derive( #[derive(
Clone, Debug, Default, PartialEq, Serialize, Deserialize, TraceRawVcs, ValueDebugFormat, Clone, Debug, Default, PartialEq, Serialize, Deserialize, TraceRawVcs, ValueDebugFormat,
)] )]
pub struct RoaringBitmapWrapper(#[turbo_tasks(trace_ignore)] RoaringBitmap); pub struct RoaringBitmapWrapper(#[turbo_tasks(trace_ignore)] pub RoaringBitmap);
impl TaskInput for RoaringBitmapWrapper { impl TaskInput for RoaringBitmapWrapper {
fn is_transient(&self) -> bool { fn is_transient(&self) -> bool {
......
...@@ -29,6 +29,7 @@ use turbopack::{ ...@@ -29,6 +29,7 @@ use turbopack::{
ModuleAssetContext, ModuleAssetContext,
}; };
use turbopack_core::{ use turbopack_core::{
chunk::ChunkingConfig,
compile_time_defines, compile_time_defines,
compile_time_info::CompileTimeInfo, compile_time_info::CompileTimeInfo,
condition::ContextCondition, condition::ContextCondition,
...@@ -415,6 +416,10 @@ async fn run_test_operation(prepared_test: ResolvedVc<PreparedTest>) -> Result<V ...@@ -415,6 +416,10 @@ async fn run_test_operation(prepared_test: ResolvedVc<PreparedTest>) -> Result<V
env, env,
RuntimeType::Development, RuntimeType::Development,
) )
.ecmascript_chunking_config(ChunkingConfig {
min_chunk_size: 20_000,
..Default::default()
})
.build(); .build();
let jest_entry_source = FileSource::new(jest_entry_path); let jest_entry_source = FileSource::new(jest_entry_path);
......
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