chrisgoringe / cg-use-everywhere

Apache License 2.0
471 stars 33 forks source link

High CPU usage when merging UE? node with custom node #164

Closed LukeG89 closed 6 months ago

LukeG89 commented 6 months ago

As you asked, I create an issue just for that. In the testing video you can see that the issue only involves Anything Everywhere? node, the other UE nodes work fine. Also in my case (gaming laptop), it increases integrated GPU usage as well.

https://github.com/chrisgoringe/cg-use-everywhere/assets/161304036/3c95ff45-1f8f-4f83-b664-dd2db48da28e

chrisgoringe commented 6 months ago

TL;DR - I think this has been fixed as a side effect of the fix of #144. Could you check?

It's odd: when you read certain information from a group node, as a side effect it writes the values of the widgets back onto them (even though they haven't changed). But writing to a widget invalidates the UE network (because if you change a regex, the network changes). Which means the UE network ends up self-invalidating, so it is perpetually recalculating!

You'd think it would be easy to say "if the new value is the same as the old value, just ignore", but place that can be done is in the core code (I've submitted https://github.com/comfyanonymous/ComfyUI/pull/3093)

When I fixed #144 I discovered a side effect was that the node highlight wasn't working - and this was why.

Anyway, I've set a flag in the UE code to disable invalidation while reading the list, so now the read->write->update->callback->invalid sequence is broken.

JorgeR81 commented 6 months ago

Maybe @LukeG89 could give a more definitive answer on this.

Before the latest update, I did noticed the fan noise from my CPU cooler, when I was building some complex group nodes.

But now it seems better.

LukeG89 commented 6 months ago

Yes! It's perfect now! Great job @chrisgoringe! 🔥🔥🔥