File tree Expand file tree Collapse file tree 1 file changed +14
-7
lines changed
Expand file tree Collapse file tree 1 file changed +14
-7
lines changed Original file line number Diff line number Diff line change @@ -83,13 +83,20 @@ def load_function_stats(self) -> None:
8383 self ._function_stats = {}
8484
8585 def _get_function_stats (self , function_to_optimize : FunctionToOptimize ) -> dict | None :
86- # First try qualified_name, then function_name, avoid allocating a list
87- key1 = f"{ function_to_optimize .file_path } :{ function_to_optimize .qualified_name } "
88- stats = self ._function_stats .get (key1 )
89- if stats is not None :
90- return stats
91- key2 = f"{ function_to_optimize .file_path } :{ function_to_optimize .function_name } "
92- return self ._function_stats .get (key2 , None )
86+ relative_path = function_to_optimize .file_path .as_posix ()
87+ absolute_path = function_to_optimize .file_path .resolve ().as_posix ()
88+
89+ for file_path in [relative_path , absolute_path ]:
90+ key1 = f"{ file_path } :{ function_to_optimize .qualified_name } "
91+ stats = self ._function_stats .get (key1 )
92+ if stats is not None :
93+ return stats
94+ key2 = f"{ file_path } :{ function_to_optimize .function_name } "
95+ stats = self ._function_stats .get (key2 )
96+ if stats is not None :
97+ return stats
98+
99+ return None
93100
94101 def get_function_ttx_score (self , function_to_optimize : FunctionToOptimize ) -> float :
95102 stats = self ._get_function_stats (function_to_optimize )
You can’t perform that action at this time.
0 commit comments