diff --git a/src/fuzz_introspector/datatypes/project_profile.py b/src/fuzz_introspector/datatypes/project_profile.py index 64e529fe5..6dfda72f9 100644 --- a/src/fuzz_introspector/datatypes/project_profile.py +++ b/src/fuzz_introspector/datatypes/project_profile.py @@ -144,7 +144,8 @@ def __init__(self, profiles: List[fuzzer_profile.FuzzerProfile], # Add all functions from the various profiles into the merged profile. Don't # add duplicates logger.info("Creating all_functions dictionary") - excluded_functions = {"sanitizer", "llvm", "LLVMFuzzerTestOneInput"} + excluded_functions_tuple = ("sanitizer", "llvm", + "LLVMFuzzerTestOneInput") for profile in profiles: # Handles jvm constructors for fd in profile.all_class_constructors.values(): @@ -158,9 +159,14 @@ def __init__(self, profiles: List[fuzzer_profile.FuzzerProfile], # Handles normal functions for fd in profile.all_class_functions.values(): + # Performance Optimization: Avoid any() with generator for O(N) substring checks. # continue if the function is to be excluded - if any(to_exclude in fd.function_name - for to_exclude in excluded_functions): + to_exclude = False + for ex in excluded_functions_tuple: + if ex in fd.function_name: + to_exclude = True + break + if to_exclude: continue current_fd = self.all_functions.get(fd.function_name)