WASasquatch / was-node-suite-comfyui

An extensive node suite for ComfyUI with over 210 new nodes
MIT License
1.1k stars 164 forks source link

WAS Node Suite extremely slow to load on startup (3.9s) #281

Open oxysoft opened 9 months ago

oxysoft commented 9 months ago

Hi, I would like to report the poor performance of this node suite for startup / initialization, as you can see from this line in my log:

   3.9 seconds: D:\Projects\ComfyUI_windows_portable\ComfyUI\custom_nodes\was-node-suite-comfyui  

That is almost 4x as long as the next one in my list, so I highly recommend that an investigation be done to understand what is taking so long.

WASasquatch commented 9 months ago

You do realize the sheer size of WAS Node Suite, right? It's the largest custom node suite for ComfyUI.

Not to mention 4s is nothing to write home about... This is even used on prod for commercial uses.

There is I/O checking (settings) which is only as fast as the HDD it's deployed on, and then package checks on whether it should even import X or not using pip freeze, so if your env is blogged down, that'll be a blogged down call too.

oxysoft commented 9 months ago

I am well aware, but most workflows require maybe 1 or 2 node max from this suite at once, so there is clearly room for optimization if not downright splitting up the project. You've encouraged people to use a giant monolithic codebase, and now everybody assumes you have it when sharing their workflows.

If you have done everything you can and the overhead is simply from registering all the classes (which it probably is, because I can see that your imports are clean) surely it is time to discuss with comfyanonymous about a lazy loading mechanism for nodes. I mean in the grand scheme of things, registering thousands of nodes on startup when the user will only be using 20-30 throughout their session seems really really sus.

Four seconds is a huge deal, the ultimate state of quality is to have instantaneous startup - open the batch file and immediately the web page opens. All these delays seriously impact my ability to work as an artist, when the creative stroke comes out of nowhere you don't have forever to actuate on it, you have to be fast. We can't just keep the Comfy UI server open all the time because it takes up major RAM and VRAM.

WASasquatch commented 9 months ago

I am simply not worried about 3.9s as a one time thing during startup. Sorry. Lol that is ridiculous to make a issue report about. It also takes 1.2s for me so I am assuming your system is slower for this sort of thing, or a slow HDD.

Your report has nothing to do with the operation of nodes in the flow, and is obsessive over startup times. It takes seconds for ComfyUI Manager to process prestartup scripts even though it does nothing, and everyone has that too. It's a startup procedure. Most software takes a bit to startup in DCC (digital content creation) field.

poisenbery commented 9 months ago

image

This isn't a "Bug" this is a skill issue.

Your report has nothing to do with the operation of nodes in the flow

This is becoming very common in the AI scene

kunibald413 commented 9 months ago

caching the packages in WAS_Node_Suite.py can save some time on startup (on my setup a few secs)

# Freeze PIP modules
_packages_cached = None
def packages(versions=False):
    global _packages_cached
    if not _packages_cached:
        import sys
        import subprocess
        _packages_cached = [( r.decode().split('==')[0] if not versions else r.decode() ) for r in subprocess.check_output([sys.executable, '-s', '-m', 'pip', 'freeze']).split()]
    return _packages_cached