PVL Switch
Pick a branch and skip all the wasted work
- on_true
- on_false
- *
The bread and butter of conditional ComfyUI is a switch: a boolean, two inputs, one output - pass on_true when true, on_false when false. PVL Switch does exactly that, with the detail that makes it worth more than the fifty other switches out there: it's lazy. Only the branch you select actually gets evaluated. The other side of the graph doesn't run at all.
That's the node's whole personality, and the author's description says it plainly: "Choose between two inputs based on a boolean switch, evaluating only the selected branch." If you've ever A/B'd two expensive things - two samplers, two model loaders, a local model vs a cloud API node - through a naive switch, you know the pain: ComfyUI runs both sides and you just pick which output to look at. This node doesn't.
It ships in pvlprk/comfyui-pvl-api-nodes ("ComfyUI Assistant Node").
How it works
switch- the boolean. Default false.on_true/on_false- wildcard inputs. The lazy bit is implemented via ComfyUI'scheck_lazy_status: the node tells the executor exactly which input to compute, based on the switch value. Ifswitchis true, onlyon_true's upstream is scheduled. If false, onlyon_false's.- Output - wildcard
*, mirroring the selected input's type.
Because both inputs are wildcard, you can switch between almost anything: two images, two prompts, two step counts, two entirely different subgraphs. The type flows through.
When the laziness actually matters
The headline use: conditional execution of slow branches. Put a heavy "quality pass" (upscale + detailer, or a fal.ai/Gemini API call) on one side, a fast "just save it" path on the other, and toggle with a flag. With a normal switch you'd burn the expensive call every run; with this one the dead branch is free. It's also the clean way to do model A/B without loading both: only the chosen model loads.
It's the same family as the pack's bigger siblings - PVL Switch x10 and Switch Huge for 10-way routing - but for a simple true/false choice, this is the one you actually want: two inputs, zero case tables to fill in.
Installing
cd ComfyUI/custom_nodes
git clone https://github.com/pvlprk/comfyui-pvl-api-nodes
restart, or install via ComfyUI Manager (search "ComfyUI Assistant Node"). No models, no dependencies.
The gotchas
- Lazy evaluation only skips the unchosen input's chain when the upstream isn't needed elsewhere. If the same expensive node feeds both branches (or something else in the graph), it still runs - laziness doesn't deduplicate.
- Wildcard inputs accept anything, but the output type follows the chosen branch. Switching between two different types (a model vs a string) will connect but may confuse downstream nodes - keep both branches type-consistent.
- It's a 2-way switch, full stop. Ten inputs? That's the x10 node's job.
Inputs (3)
| Name | Type | Default | Description |
|---|---|---|---|
| switch | BOOLEAN | false | — |
| on_true | * | — | |
| on_false | * | — |
Outputs (1)
| Name | Type | Description |
|---|---|---|
| * | * | — |