ComfyUI icon indicating copy to clipboard operation
ComfyUI copied to clipboard

Fix unintended exponential algorithm in recursive_will_execute

Open tomKPZ opened this issue 11 months ago • 2 comments

The intention of recursive_will_execute is to count the number of nodes that will be executed given some target nodes. However, the implementation used a list instead of a set for the count, so nodes were unintentionally getting duplicated. The count of each node ended up being the number of paths that reach that node instead of just 1. In general, there may be exponentially many paths which led to OOM errors with deeper graphs.

tomKPZ avatar Mar 04 '24 03:03 tomKPZ

Friendly ping

tomKPZ avatar Mar 16 '24 17:03 tomKPZ

Are any further changes required? If you're uncomfortable landing as-is, I can revert the changes in recursive_output_delete_if_changed and only keep the changes in recursive_will_execute, and the issue will still be fixed.

tomKPZ avatar Apr 08 '24 17:04 tomKPZ