forked from vercel/next.js
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[Turbopack] Reduce memory (vercel#75723)
### What? * avoid cloning SourceMap for ignore list * shrink vec before converting to Rope * shrink Strings too * shrink source map
- Loading branch information
Showing
11 changed files
with
67 additions
and
57 deletions.
There are no files selected for viewing
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,23 @@ | ||
use std::collections::HashSet; | ||
|
||
use const_format::concatcp; | ||
use sourcemap::SourceMap; | ||
|
||
use crate::SOURCE_MAP_PREFIX; | ||
|
||
pub fn add_default_ignore_list(map: &mut SourceMap) { | ||
let mut ignored_ids = HashSet::new(); | ||
|
||
for (source_id, source) in map.sources().enumerate() { | ||
if source.starts_with(concatcp!(SOURCE_MAP_PREFIX, "[next]")) | ||
|| source.starts_with(concatcp!(SOURCE_MAP_PREFIX, "[turbopack]")) | ||
|| source.contains("/node_modules/") | ||
{ | ||
ignored_ids.insert(source_id); | ||
} | ||
} | ||
|
||
for ignored_id in ignored_ids { | ||
map.add_to_ignore_list(ignored_id as _); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters