Nodes/comfyui-svdint4/Lazy If / Else
ComfyUI Node

Lazy If / Else

A switch that only runs the branch you picked

By wjie98·Created 2 months ago·Updated 3 days ago· 2
Lazy If / Else
  • on_true
  • on_false
  • value
condition

The name tells you the whole pitch: this is an A/B switch, but it lazy-evaluates. A plain switch in ComfyUI passes the branch you selected - but the branch you didn't select still gets fully computed upstream, because its inputs are connected and ComfyUI runs everything a node depends on. Lazy If / Else asks the executor to only evaluate the chosen branch. Wire two expensive paths into it and the loser doesn't run at all.

Concretely: condition (a BOOLEAN) picks between on_true and on_false, and the single value output carries whichever you picked. Both branches are typed *, the wildcard - model, latent, image, conditioning, anything - and both are optional, so you can even leave one unconnected and treat this as a simple gate. The lazy part is handled by ComfyUI's check_lazy_status machinery: the node declares it only needs the selected input, and the engine skips the other branch's whole upstream subtree.

When it's actually worth it

The textbook case is two model loaders in one workflow - a fast quantized path and a quality path, toggled by a primitive boolean. With a normal switch, both models load every run and you eat the VRAM and startup time for the one you're not using. Here, only the selected model loads. The same logic applies to two VAE encodes, an upscale branch versus a pass-through, or any "heavy vs. cheap" fork you'd otherwise build with bypasses.

The one honest caveat, straight from the node description: an unselected branch is skipped unless another output in the workflow also requires it. If something else downstream consumes the other branch too, ComfyUI correctly computes it - lazy evaluation can't defeat a real dependency. That's not a bug, it's the engine refusing to lie to you.

Install and gotchas

Pure logic, no kernel, no models:

cd ComfyUI/custom_nodes
git clone https://github.com/wjie98/comfyui-svdint4

or ComfyUI Manager → search "Turing Utils", restart. That's it.

Two things worth knowing before you build a whole graph around it. First, because the output is the * wildcard, the node won't type-check what flows out - wire it into a socket and make sure the actual value type matches, or you'll get a runtime error at the consumer instead of a friendly red link. Second, there are other lazy-switch implementations floating around the ecosystem (this is a pattern several packs discovered independently), so if you're sharing a workflow, the node travels with the pack - whoever opens it needs Turing Utils installed. Search aliases include "switch", "branch", and "if/else", so it's findable in the node palette even if you forget the display name.

CategoryTuring Utils/logic

Inputs (3)

NameTypeDefaultDescription
conditionBOOLEAN
on_trueopt*Evaluated only when condition is true.
on_falseopt*Evaluated only when condition is false.

Outputs (1)

NameTypeDescription
value*