ComfyUI Node

Comap

One input, several pipelines, side by side

By Duanyll·Created 11 months ago·Updated 4 months ago· 2
Comap
  • functions
  • x
  • LIST

Comap is the "compare" node. Where Map runs one function over many values, Comap runs many functions over one value and collects each result. Think of it as fanning a single input into several branches that all get evaluated side by side - perfect for A/B tests, style comparisons, or trying three post-processing paths on the same image without rebuilding the wiring every time.

The inputs

  • functions - a LIST of CLOSUREs. Each one receives the same input x.
  • x - a single value of any type; the thing you're fanning out.
  • output - a LIST of results, one per function, in the same order as the functions list.

So if you've defined three functions - say "sharpen," "denoise," "anime-style" - a LIST containing all three plus one image gives you back a LIST of three images. That's the whole pitch.

How it works

Same coroutine machinery as every high-order node here: Comap iterates over the list of closures and, per function, yields (function, [x]) so the pack can expand that function's body into real graph nodes and run it. Results accumulate in order. The COMFYUI_FUNCTIONAL_COROUTINE_LIMIT (default 100) still applies - and note it caps the number of functions here, not items, so a huge functions list can trip it the same way a huge items list trips Map.

The awkward part: building a LIST of functions

Here's the thing nobody mentions up front: this node's functions input wants a list of function objects, and building that is on you. In practice you build the LIST the same way you'd build any other list in this pack - via the Basic Data Handling pack's LIST machinery, or by bundling multiple closures into one LIST inside a function. It's the least beginner-friendly input in the whole pack, and honestly it's the reason Comap sees less use than Map. If your comparison needs are simple - two or three fixed branches - you can often get the same result with plain wiring and skip the LIST-of-closures gymnastics.

Where people get burned

  • Native Data List deadlock - convert everything to Basic Data Handling LIST.
  • Order matters - results come back in the same order you put functions in; label or index your branches if you need to tell them apart downstream.
  • The closure list itself - if you see a "function" input that won't accept your LIST, check you're feeding the LIST type, not a single CLOSURE.

Installing it

Ships in Duanyll/comfyui_functional. ComfyUI Manager: search "Duanyll/comfyui_functional", or:

cd ComfyUI/custom_nodes
git clone https://github.com/Duanyll/comfyui_functional
# restart ComfyUI

No models, no pip deps - but install Basic Data Handling for the LIST type. Comap is a nice-to-have, not the pack's star; try Map first, come back to Comap when you actually want the side-by-side comparison workflow.

Categoryduanyll/functional/high_order

Inputs (2)

NameTypeDefaultDescription
functionsLIST
x*

Outputs (1)

NameTypeDescription
LISTLIST