小珠光编号切换
50-way any-type switch that only pays for the branch you pick
- value0
- value1
- value2
- value3
- value4
- value5
- value6
- value7
- value8
- value9
- value10
- value11
- value12
- value13
- value14
- value15
- value16
- value17
- value18
- value19
- value20
- value21
- value22
- value23
- value24
- value25
- value26
- value27
- value28
- value29
- value30
- value31
- value32
- value33
- value34
- value35
- value36
- value37
- value38
- value39
- value40
- value41
- value42
- value43
- value44
- value45
- value46
- value47
- value48
- value49
- output
ComfyUI has a million switch nodes, and they mostly fall into two camps: ones that route typed values, and ones that accept anything. XiaozhuguangNumberSwitch (小珠光编号切换) is an anything-goes switch with a party trick: all fifty of its value inputs are lazy. Pick input number 12, and the engine computes input 12's upstream and nothing else. Wire twelve expensive sampler branches into one switch and only the selected one runs. That's the feature that separates it from the merge-and-select pile.
Here's the mechanism, straight from the source (which the author notes borrows the lazy pattern from easy-use's anythingIndexSwitch). Every value0 through value49 input is declared lazy: true. When the node first executes, check_lazy_status looks at which input select points at, asks the engine to evaluate only that branch, and the node runs a second time with just that value in hand and outputs it. Unconnected inputs never get requested - the code checks the key is actually present in the args before asking, which dodges the engine's NodeInputError that naive switches trip over. And if the selected input ends up empty, it outputs None instead of dying.
Inputs and output:
- select - the index, 0–49 (clamped if you go out of range).
- value0 … value49 - fifty any-type (
*) inputs. Connect whatever: models, images, latents, strings, booleans - they don't have to match each other. - output - whichever value is selected.
The 50-way width is the honest trade. It's a big node on canvas, and for most workflows a 4- or 8-way switch is plenty. You reach for this one when you genuinely have many variants - a style selector with a dozen baked prompts, a batch of LoRA combos, a resolution picker - because at that scale the lazy evaluation stops being a nicety. If you've got a switch that routes a heavy model-loading branch among several options, the laziness means switching to option 3 doesn't load options 1 and 2 just to throw them away. That's real VRAM and real seconds.
Where people get burned: remember what lazy means. Only the selected branch computes, so anything in an unselected branch that you expected to run as a side effect - a save, a counter - silently doesn't. And because unconnected inputs are just absent, switching to an empty slot outputs None and downstream nodes may choke on it; keep a default connected to the slot you expect people to land on. Also note the select input is forceInput-style: you're expected to wire a value into it (or a seed/slider node) rather than typing on the node.
Same pack install as everything here - ComfyUI Manager → ComfyUI-xiaozhuguang → restart, or git clone https://github.com/xiaozhuguang/ComfyUI-xiaozhuguang into custom_nodes. No dependencies. If your graph is a small program with many branches, this is the switch that doesn't tax you for the paths you don't take.
Inputs (51)
| Name | Type | Default | Description |
|---|---|---|---|
| select | INT | 00–49 | — |
| value0opt | * | — | |
| value1opt | * | — | |
| value2opt | * | — | |
| value3opt | * | — | |
| value4opt | * | — | |
| value5opt | * | — | |
| value6opt | * | — | |
| value7opt | * | — | |
| value8opt | * | — | |
| value9opt | * | — | |
| value10opt | * | — | |
| value11opt | * | — | |
| value12opt | * | — | |
| value13opt | * | — | |
| value14opt | * | — | |
| value15opt | * | — | |
| value16opt | * | — | |
| value17opt | * | — | |
| value18opt | * | — | |
| value19opt | * | — | |
| value20opt | * | — | |
| value21opt | * | — | |
| value22opt | * | — | |
| value23opt | * | — | |
| value24opt | * | — | |
| value25opt | * | — | |
| value26opt | * | — | |
| value27opt | * | — | |
| value28opt | * | — | |
| value29opt | * | — | |
| value30opt | * | — | |
| value31opt | * | — | |
| value32opt | * | — | |
| value33opt | * | — | |
| value34opt | * | — | |
| value35opt | * | — | |
| value36opt | * | — | |
| value37opt | * | — | |
| value38opt | * | — | |
| value39opt | * | — | |
| value40opt | * | — | |
| value41opt | * | — | |
| value42opt | * | — | |
| value43opt | * | — | |
| value44opt | * | — | |
| value45opt | * | — | |
| value46opt | * | — | |
| value47opt | * | — | |
| value48opt | * | — | |
| value49opt | * | — |
Outputs (1)
| Name | Type | Description |
|---|---|---|
| output | * | — |