ComfyUI icon indicating copy to clipboard operation
ComfyUI copied to clipboard

Reduce repeated calls of get_immediate_node_signature in cache

Open JettHu opened this issue 1 year ago • 3 comments

CacheKeySetInputSignature.get_immediate_node_signature is called multiple times for the same node as ancestors of different nodes.

Most nodes are fine, but when there are time-consuming operations in class_def.INPUT_TYPES(), such as get_filename_list, the performance of cache.set_prompt becomes quite bad on machines with poor disk performance.

On one of my devices, set_prompt of caches.outputs and caches.ui took 500+ms before modification, and it would be worse if there were more time-consuming nodes. This PR reduces the time to 80ms on average

JettHu avatar Sep 10 '24 09:09 JettHu

@guill #4882

Trung0246 avatar Sep 11 '24 19:09 Trung0246

(Automated Bot Message) CI Tests are running, you can view the results at https://ci.comfy.org/?branch=4871%2Fmerge

github-actions[bot] avatar Sep 12 '24 11:09 github-actions[bot]

(Automated Bot Message) CI Tests are running, you can view the results at https://ci.comfy.org/?branch=4871%2Fmerge

github-actions[bot] avatar Sep 13 '24 00:09 github-actions[bot]

Had to revert this because: https://github.com/comfyanonymous/ComfyUI/issues/4914

comfyanonymous avatar Sep 14 '24 03:09 comfyanonymous

Had to revert this because: #4914

I found the problem and will submit a PR for another optimization method later.

JettHu avatar Sep 14 '24 09:09 JettHu