Optimize appendHeader

perf(fetch/headers): optimize appendHeader (#12234)
Optimize appendHeaderperfoptimize appendheader fetch headers

Committed by AaronO

commit message
perf(fetch/headers): optimize appendHeader (#12234)

Use a single regex to check for `\0`, `\n`, `\r` instead of 3 `String.includes(...)` calls

Editor assessment

The subject names the optimized function exactly: appendHeader. The body states the mechanism concretely: one regex now checks for the three forbidden characters instead of three String.includes calls. That is a real implementation explanation, though no measurement quantifies the win. Type perf and the fetch/headers scope are accurate. No footers beyond the PR number. Hygiene is clean. A precise, complete message for a targeted hot-path optimization.

Browse categories

More perf examples · Back to search