Subchapter 7.34
references/support-topics/function-invocation-reduction.mdMarkdown1 KBView on GitHub
For slow routes, prove duplicated in-request work in the listed files before recommending consolidation or memoization.
Look for repeated awaits, duplicate fetches, same-app route handler calls, and helpers that run more than once per request.
Do not collapse endpoints called independently by different clients. Do not persistently cache user-specific data. Do not recommend Promise.all for CPU-bound or compile-bound work unless trace/span evidence shows wait time to overlap. High cpu.p95 near latency.p95 is a warning sign, not proof of a latency win.
Quote duplicated call sites with latency.p95, cpu.p95, or request-count evidence. If the fix overlaps awaits, cite measured helper/span timing or state the impact is unmeasured.