crystian / ComfyUI-Crystools

A powerful set of tools for ComfyUI
MIT License
697 stars 33 forks source link

Importing ComfyUI-Crystools is a little slow #88

Closed Maslino closed 1 month ago

Maslino commented 1 month ago

The import time of ComfyUI-Crystools is about 2 ~ 3 seconds on my server. It is a little slow. Can the import procedure be improved?

Expected behavior
Can the import time be less than one second? Is that possible?

Screenshots

Import times for custom nodes:
[2024-07-29 03:20]    0.0 seconds: /home/app/ComfyUI/custom_nodes/websocket_image_save.py
[2024-07-29 03:20]    0.0 seconds: /home/app/ComfyUI/custom_nodes/AIGODLIKE-COMFYUI-TRANSLATION
[2024-07-29 03:20]    0.0 seconds: /home/app/ComfyUI/custom_nodes/ControlNet-LLLite-ComfyUI
[2024-07-29 03:20]    0.0 seconds: /home/app/ComfyUI/custom_nodes/ComfyUI_TiledKSampler
[2024-07-29 03:20]    0.0 seconds: /home/app/ComfyUI/custom_nodes/FreeU_Advanced
[2024-07-29 03:20]    0.0 seconds: /home/app/ComfyUI/custom_nodes/ComfyUI-WD14-Tagger
[2024-07-29 03:20]    0.0 seconds: /home/app/ComfyUI/custom_nodes/ComfyUI_experiments
[2024-07-29 03:20]    0.0 seconds: /home/app/ComfyUI/custom_nodes/PowerNoiseSuite
[2024-07-29 03:20]    0.0 seconds: /home/app/ComfyUI/custom_nodes/images-grid-comfy-plugin
[2024-07-29 03:20]    0.0 seconds: /home/app/ComfyUI/custom_nodes/ComfyUI-Custom-Scripts
[2024-07-29 03:20]    0.0 seconds: /home/app/ComfyUI/custom_nodes/ComfyUI_UltimateSDUpscale
[2024-07-29 03:20]    0.0 seconds: /home/app/ComfyUI/custom_nodes/Derfuu_ComfyUI_ModdedNodes
[2024-07-29 03:20]    0.0 seconds: /home/app/ComfyUI/custom_nodes/ComfyUI-VideoHelperSuite
[2024-07-29 03:20]    0.0 seconds: /home/app/ComfyUI/custom_nodes/ComfyUI-Advanced-ControlNet
[2024-07-29 03:20]    0.0 seconds: /home/app/ComfyUI/custom_nodes/comfyui-workspace-manager
[2024-07-29 03:20]    0.0 seconds: /home/app/ComfyUI/custom_nodes/ComfyUI_IPAdapter_plus
[2024-07-29 03:20]    0.0 seconds: /home/app/ComfyUI/custom_nodes/comfyui_controlnet_aux
[2024-07-29 03:20]    0.0 seconds: /home/app/ComfyUI/custom_nodes/stability-ComfyUI-nodes
[2024-07-29 03:20]    0.0 seconds: /home/app/ComfyUI/custom_nodes/ComfyUI_Comfyroll_CustomNodes
[2024-07-29 03:20]    0.0 seconds: /home/app/ComfyUI/custom_nodes/ComfyUI-Manager
[2024-07-29 03:20]    0.0 seconds: /home/app/ComfyUI/custom_nodes/ComfyUI-Inspire-Pack
[2024-07-29 03:20]    0.1 seconds: /home/app/ComfyUI/custom_nodes/ComfyUI-Marigold
[2024-07-29 03:20]    0.2 seconds: /home/app/ComfyUI/custom_nodes/ComfyUI_FizzNodes
[2024-07-29 03:20]    0.2 seconds: /home/app/ComfyUI/custom_nodes/ComfyUI-AnimateDiff-Evolved
[2024-07-29 03:20]    0.4 seconds: /home/app/ComfyUI/custom_nodes/ComfyUI-Impact-Pack
[2024-07-29 03:20]    0.8 seconds: /home/app/ComfyUI/custom_nodes/ComfyUI_Custom_Nodes_AlekPet
[2024-07-29 03:20]    2.3 seconds: /home/app/ComfyUI/custom_nodes/ComfyUI-Crystools

Versions:
Copy the output of the console (4 parts), like this:

[2024-07-29 03:20] ** Python version: 3.10.12 (main, Nov 20 2023, 15:14:05) [GCC 11.4.0]
Total VRAM 24217 MB, total RAM 362310 MB
[2024-07-29 03:20] Set vram state to: NORMAL_VRAM
[2024-07-29 03:20] [Crystools INFO] Crystools version: 1.15.0
[2024-07-29 03:20] [Crystools INFO] CPU: Intel(R) Xeon(R) Platinum 8457C - Arch: x86_64 - OS: Linux 5.4.210-4.ve1.x86_64
[2024-07-29 03:20] [Crystools INFO] Pynvml (Nvidia) initialized.
[2024-07-29 03:20] [Crystools INFO] GPU/s:
[2024-07-29 03:20] [Crystools INFO] 0) NVIDIA GeForce RTX 4090
[2024-07-29 03:20] [Crystools INFO] NVIDIA Driver: 535.86.10
[2024-07-29 03:20] ### Loading: ComfyUI-Manager (V2.48.1)
[2024-07-29 03:20] ### ComfyUI Revision: 2394 [10b43cee] *DETACHED | Released on '2024-07-24'
Pythonpa commented 1 month ago

The same,maybe have some solutions to speed it up

crystian commented 1 month ago

yeap, I tried to reduce it, but it times come from the drivers, I can't do anything, sorry

Maslino commented 1 month ago

yeap, I tried to reduce it, but it times come from the drivers, I can't do anything, sorry

The slow import is caused by cpuinfo.get_cpu_info(). You can refer to this issue for more infomation: https://github.com/workhorsy/py-cpuinfo/issues/155

CPU frequency is not necessary. ComfyUI-Crystools only prints cpu model and arch.

The solution could be: For windows, macos and linux, use system's specified method to get cpu base info. For other operating systems, fallback to use cpuinfo.get_cpu_info().

crystian commented 1 month ago

oh! nice, I will check it!

crystian commented 1 month ago

ummm, I use the release 9.0.0 that was on version 4.0.0 ¯_(ツ)_/¯

but, I reuse an object, it reduce 1 to 1 .9 seconds

try it please (1.16.1)