1- use std:: collections:: { HashMap , HashSet } ;
2-
31use anyhow:: { bail, Result } ;
42use next_core:: emit_assets;
3+ use rustc_hash:: { FxHashMap , FxHashSet } ;
54use serde:: { Deserialize , Serialize } ;
65use turbo_rcstr:: RcStr ;
76use turbo_tasks:: {
@@ -31,7 +30,7 @@ use turbopack_core::{
3130struct MapEntry {
3231 assets_operation : OperationVc < OutputAssets > ,
3332 /// Precomputed map for quick access to output asset by filepath
34- path_to_asset : HashMap < ResolvedVc < FileSystemPath > , ResolvedVc < Box < dyn OutputAsset > > > ,
33+ path_to_asset : FxHashMap < ResolvedVc < FileSystemPath > , ResolvedVc < Box < dyn OutputAsset > > > ,
3534}
3635
3736// HACK: This is technically incorrect because `path_to_asset` contains `ResolvedVc`...
@@ -49,15 +48,15 @@ pub struct PathToOutputOperation(
4948 /// It may not be 100% correct for the key (`FileSystemPath`) to be in a `ResolvedVc` here, but
5049 /// it's impractical to make it an `OperationVc`/`OperationValue`, and it's unlikely to
5150 /// change/break?
52- HashMap < ResolvedVc < FileSystemPath > , FxIndexSet < OperationVc < OutputAssets > > > ,
51+ FxHashMap < ResolvedVc < FileSystemPath > , FxIndexSet < OperationVc < OutputAssets > > > ,
5352) ;
5453
5554// HACK: This is technically incorrect because the map's key is a `ResolvedVc`...
5655unsafe impl OperationValue for PathToOutputOperation { }
5756
5857// A precomputed map for quick access to output asset by filepath
5958type OutputOperationToComputeEntry =
60- HashMap < OperationVc < OutputAssets > , OperationVc < OptionMapEntry > > ;
59+ FxHashMap < OperationVc < OutputAssets > , OperationVc < OptionMapEntry > > ;
6160
6261#[ turbo_tasks:: value]
6362pub struct VersionedContentMap {
@@ -77,8 +76,8 @@ impl VersionedContentMap {
7776 // should be a singleton for each project.
7877 pub fn new ( ) -> ResolvedVc < Self > {
7978 VersionedContentMap {
80- map_path_to_op : State :: new ( PathToOutputOperation ( HashMap :: new ( ) ) ) ,
81- map_op_to_compute_entry : State :: new ( HashMap :: new ( ) ) ,
79+ map_path_to_op : State :: new ( PathToOutputOperation ( FxHashMap :: default ( ) ) ) ,
80+ map_op_to_compute_entry : State :: new ( FxHashMap :: default ( ) ) ,
8281 }
8382 . resolved_cell ( )
8483 }
@@ -142,7 +141,7 @@ impl VersionedContentMap {
142141 let mut changed = false ;
143142
144143 // get current map's keys, subtract keys that don't exist in operation
145- let mut stale_assets = map. 0 . keys ( ) . copied ( ) . collect :: < HashSet < _ > > ( ) ;
144+ let mut stale_assets = map. 0 . keys ( ) . copied ( ) . collect :: < FxHashSet < _ > > ( ) ;
146145
147146 for ( k, _) in entries. iter ( ) {
148147 let res = map. 0 . entry ( * k) . or_default ( ) . insert ( assets_operation) ;
0 commit comments