Files
ComfyUI/comfy_api
Deep Mehta 02c76019ad feat(cache-provider): expose per-node compute time to providers
Adds two new fields to CacheContext that lets external CacheProvider
implementations make cost-aware caching decisions:

- compute_time_ms        — wall-clock for this node's get_output_data call
- compound_compute_ms    — own time + sum of all ancestor compute times

The executor times each call to get_output_data and records it on the
output cache. _build_context walks the dynprompt graph from the target
node to sum ancestor times (cached ancestors contribute 0, a correct
lower bound for what a future hit on this node would save).

Why: a small leaf-output downstream of an expensive chain is worth
caching even though the leaf itself is cheap — because a future hit
prunes the whole subgraph. A pure leaf with no expensive ancestors is
not worth the round-trip. Providers couldn't distinguish these without
the timing data, leading to size-based heuristics that systematically
mis-cached the long tail.

Backward-compatible: new fields default to 0.0, so existing providers
keep working unchanged. Providers that opt in can read context.compound_compute_ms
in should_cache() to gate on real work-saved.
2026-05-20 17:30:08 -07:00
..
2026-04-23 20:51:34 -07:00
2025-07-29 22:17:22 -04:00
2025-07-29 22:17:22 -04:00
2025-07-29 22:17:22 -04:00
2025-07-29 22:17:22 -04:00