We don't always require an array of header values to be extracted. Sometimes we just need to be able to iterate through them. For 'regular' header values we incur an allocation for the array, for values in their canonical form we incure at least two allocations. We can do better than this by providing a header value sequence.
Modifications:
Add new API to HPACKHeaders for getting a sequence of header values which can optionally be in their canonical form.
Update the API of the two existing subscripts to use this new API. For subscript(canonicalForm:) we save an allocation by not going via subscript(name:).
Motivation:
We don't always require an array of header values to be extracted. Sometimes we just need to be able to iterate through them. For 'regular' header values we incur an allocation for the array, for values in their canonical form we incure at least two allocations. We can do better than this by providing a header value sequence.
Modifications:
HPACKHeaders
for getting a sequence of header values which can optionally be in their canonical form.subscript(canonicalForm:)
we save an allocation by not going viasubscript(name:)
.Result:
subscript(canonicalForm:)