The most powerful and modular diffusion model GUI, api and backend with a graph/nodes interface. The fastest local inference engine in the world.
Print prestartup times for custom nodes.
comfyanonymous6f914fb77d5f
diff --git a/main.py b/main.pyindex 2da78d7a3..802e4bfe4 100644--- a/main.py+++ b/main.py@@ -1,22 +1,24 @@import osimport importlib.utilimport folder_paths-+import timedef execute_prestartup_script():def execute_script(script_path):- if os.path.exists(script_path):- module_name = os.path.splitext(script_path)[0]- try:- spec = importlib.util.spec_from_file_location(module_name, script_path)- module = importlib.util.module_from_spec(spec)- spec.loader.exec_module(module)- except Exception as e:- print(f"Failed to execute startup-script: {script_path} / {e}")+ module_name = os.path.splitext(script_path)[0]+ try:+ spec = importlib.util.spec_from_file_location(module_name, script_path)+ module = importlib.util.module_from_spec(spec)+ spec.loader.exec_module(module)+ return True+ except Exception as e:+ print(f"Failed to execute startup-script: {script_path} / {e}")+ return Falsenode_paths = folder_paths.get_folder_paths("custom_nodes")for custom_node_path in node_paths:possible_modules = os.listdir(custom_node_path)+ node_prestartup_times = []for possible_module in possible_modules:module_path = os.path.join(custom_node_path, possible_module)@@ -24,8 +26,19 @@ def execute_prestartup_script():continuescript_path = os.path.join(module_path, "prestartup_script.py")- execute_script(script_path)-+ if os.path.exists(script_path):+ time_before = time.perf_counter()+ success = execute_script(script_path)+ node_prestartup_times.append((time.perf_counter() - time_before, module_path, success))+ if len(node_prestartup_times) > 0:+ print("\nPrestartup times for custom nodes:")+ for n in sorted(node_prestartup_times):+ if n[2]:+ import_message = ""+ else:+ import_message = " (PRESTARTUP FAILED)"+ print("{:6.1f} seconds{}:".format(n[0], import_message), n[1])+ print()execute_prestartup_script()@@ -36,7 +49,6 @@ import itertoolsimport shutilimport threadingimport gc-import timefrom comfy.cli_args import argsimport comfy.utils