MINOR: hpack: use ist2bin() to copy header names in hpack_encode_header()
memcpy() tends to be overkill to copy short strings, better use ist's
naive functions for this. This shows a consistent 1.2% performance
gain with h2load.
diff --git a/src/hpack-enc.c b/src/hpack-enc.c
index 7c6ef6f..73a5fd1 100644
--- a/src/hpack-enc.c
+++ b/src/hpack-enc.c
@@ -116,9 +116,8 @@
out->area[len++] = 0x5c; // literal with indexing -- name="content-length" (idx 28)
else if (len_to_bytes(n.len) && len + 1 + len_to_bytes(n.len) + n.len <= size) {
out->area[len++] = 0x00; /* literal without indexing -- new name */
-
len = hpack_encode_len(out->area, len, n.len);
- memcpy(out->area + len, n.ptr, n.len);
+ ist2bin(out->area + len, n);
len += n.len;
}
else {