ComfyUI Node

ImageCacher

An IMAGE memoizer that stops redundant re-runs

By ARZUMATA·Created 2 years ago·Updated 3 months ago· 5
ImageCacher
  • image
  • IMAGE

Let's be upfront: ImageCacher is the least exciting node in the ComfyUI-ARZUMATA pack, and quite possibly the least exciting node in your whole library. It takes an IMAGE in and gives the same IMAGE back. That's the whole interface. Its job is to act as a memoizer - remember the last image it saw, and tell ComfyUI's executor "nothing changed here," so the stuff downstream of it doesn't waste time recomputing.

The mechanism is two lines of real logic. It stores the image tensor plus a hash of it. On the next run, if the incoming image hashes the same, it hands back the stored one instead; and crucially, it reports that stored hash via IS_CHANGED, which is ComfyUI's signal for whether a node's output actually changed between queue runs. When the hash matches, the executor can skip re-running everything after this node. If the image differs, it passes the new one through and updates the memo.

Where it earns its keep

ComfyUI already caches node outputs between runs, so this node is only useful in the narrow case where something upstream always reports itself as changed even when the pixels haven't - say, a node with an internal counter, a live webcam grab, or a preprocessing step that re-runs its whole pipeline on every queue entry. Drop ImageCacher after that offender and the graph gets the "it's the same image, stop" message for the downstream branches.

That's it. That's the use case. It's marked as an output node, which means it wants to sit at the end of a branch and can force execution of that branch - position it accordingly.

Installing it

It ships with the rest of the pack:

cd ComfyUI/custom_nodes
git clone https://github.com/ARZUMATA/ComfyUI-ARZUMATA

Restart ComfyUI, or install via ComfyUI Manager by searching ComfyUI-ARZUMATA. No dependencies beyond what ComfyUI already ships.

Honest notes

  • The hash is identity-based on the tensor object, not a pixel comparison. The node works by virtue of ComfyUI reusing the same tensor object when an upstream truly hasn't changed - it is not a content-deduplicator, and feeding it two different tensors with identical pixels won't collapse them into one.
  • A fresh node instance starts empty, so the first run always passes through and the benefit starts on subsequent runs in the same session. Restart and it's cold again.
  • For 99% of workflows you don't need this and shouldn't add it - an extra node is an extra thing to go wrong. But if you've got that one stubborn upstream that re-triggers its whole subtree every render, this is a legitimately cheap fix.

Call it what it is: a tiny utility for a specific annoyance, included because the pack is a "random nodes for various purposes" grab-bag. When you need it, it's exactly the right size.

Categorycache

Inputs (1)

NameTypeDefaultDescription
imageIMAGE

Outputs (1)

NameTypeDescription
IMAGEIMAGE