mirror of
https://github.com/vercel-labs/scriptc.git
synced 2026-10-28 06:53:42 +08:00
Headers kept its name/value pairs in a string array and read every element through scr_arr_get_ref (index checks, retain, release). forEach and the iterators re-sorted and rescanned the whole list for every step, and every Response or Headers built from another Headers object re-validated and re-normalized each copied pair. The Hono fixture spends 12-15% of a request there. - Pair loops read borrowed elements of the dense array (sf_pair_at). - The sort-and-combine list is cached on the Headers object and dropped by every mutation, so live iteration keeps Node's semantics. - get() of a single value returns the stored string. - Copying a Headers object whose pairs are canonical (built by the constructor or a Response) into an empty list copies the pairs; wire response headers keep the per-pair path because they may repeat names. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>