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
c16109f4
Unverified
Commit
c16109f4
authored
Oct 21, 2025
by
Niklas Mischkulnig
Committed by
GitHub
Oct 21, 2025
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Turbopack: speedup module merging (#85043)
preallocate hashmaps
parent
3f09e569
Expand all
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
142 additions
and
87 deletions
+142
-87
parallel.rs
turbopack/crates/turbo-tasks/src/parallel.rs
+27
-1
merged_modules.rs
.../crates/turbopack-core/src/module_graph/merged_modules.rs
+115
-86
No files found.
turbopack/crates/turbo-tasks/src/parallel.rs
View file @
c16109f4
...
@@ -6,7 +6,7 @@
...
@@ -6,7 +6,7 @@
use
crate
::{
use
crate
::{
scope
::
scope_and_block
,
scope
::
scope_and_block
,
util
::{
good_chunk_size
,
into_chunks
},
util
::{
Chunk
,
good_chunk_size
,
into_chunks
},
};
};
struct
Chunked
{
struct
Chunked
{
...
@@ -231,6 +231,32 @@ where
...
@@ -231,6 +231,32 @@ where
.collect
()
.collect
()
}
}
pub
fn
map_collect_chunked_owned
<
'l
,
Item
,
PerItemResult
,
Result
>
(
items
:
Vec
<
Item
>
,
f
:
impl
Fn
(
Chunk
<
Item
>
)
->
PerItemResult
+
Send
+
Sync
,
)
->
Result
where
Item
:
Send
+
Sync
,
PerItemResult
:
Send
+
Sync
+
'l
,
Result
:
FromIterator
<
PerItemResult
>
,
{
let
Some
(
Chunked
{
chunk_size
,
chunk_count
,
})
=
get_chunked
(
items
.len
())
else
{
let
len
=
items
.len
();
return
Result
::
from_iter
(
into_chunks
(
items
,
len
)
.map
(
f
));
};
let
f
=
&
f
;
scope_and_block
(
chunk_count
,
|
scope
|
{
for
chunk
in
into_chunks
(
items
,
chunk_size
)
{
scope
.spawn
(
move
||
f
(
chunk
))
}
})
.collect
()
}
#[cfg(test)]
#[cfg(test)]
mod
tests
{
mod
tests
{
use
std
::{
use
std
::{
...
...
turbopack/crates/turbopack-core/src/module_graph/merged_modules.rs
View file @
c16109f4
This diff is collapsed.
Click to expand it.
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