@@ -875,28 +875,33 @@ impl<D: Deps> DepGraphData<D> {
875
875
parent_dep_node_index : SerializedDepNodeIndex ,
876
876
frame : Option < & MarkFrame < ' _ > > ,
877
877
) -> Option < ( ) > {
878
- let dep_dep_node_color = self . colors . get ( parent_dep_node_index) ;
879
- let dep_dep_node = & self . previous . index_to_node ( parent_dep_node_index) ;
878
+ let get_dep_dep_node = || self . previous . index_to_node ( parent_dep_node_index) ;
880
879
881
- match dep_dep_node_color {
880
+ match self . colors . get ( parent_dep_node_index ) {
882
881
Some ( DepNodeColor :: Green ( _) ) => {
883
882
// This dependency has been marked as green before, we are
884
883
// still fine and can continue with checking the other
885
884
// dependencies.
886
- debug ! ( "dependency {dep_dep_node:?} was immediately green" ) ;
885
+ //
886
+ // This path is extremely hot. We don't want to get the
887
+ // `dep_dep_node` unless it's necessary. Hence the
888
+ // `get_dep_dep_node` closure.
889
+ debug ! ( "dependency {:?} was immediately green" , get_dep_dep_node( ) ) ;
887
890
return Some ( ( ) ) ;
888
891
}
889
892
Some ( DepNodeColor :: Red ) => {
890
893
// We found a dependency the value of which has changed
891
894
// compared to the previous compilation session. We cannot
892
895
// mark the DepNode as green and also don't need to bother
893
896
// with checking any of the other dependencies.
894
- debug ! ( "dependency {dep_dep_node :?} was immediately red" ) ;
897
+ debug ! ( "dependency {:?} was immediately red" , get_dep_dep_node ( ) ) ;
895
898
return None ;
896
899
}
897
900
None => { }
898
901
}
899
902
903
+ let dep_dep_node = & get_dep_dep_node ( ) ;
904
+
900
905
// We don't know the state of this dependency. If it isn't
901
906
// an eval_always node, let's try to mark it green recursively.
902
907
if !qcx. dep_context ( ) . is_eval_always ( dep_dep_node. kind ) {
@@ -922,9 +927,7 @@ impl<D: Deps> DepGraphData<D> {
922
927
return None ;
923
928
}
924
929
925
- let dep_dep_node_color = self . colors . get ( parent_dep_node_index) ;
926
-
927
- match dep_dep_node_color {
930
+ match self . colors . get ( parent_dep_node_index) {
928
931
Some ( DepNodeColor :: Green ( _) ) => {
929
932
debug ! ( "managed to FORCE dependency {dep_dep_node:?} to green" ) ;
930
933
return Some ( ( ) ) ;
0 commit comments