mirror of
https://git.haproxy.org/git/haproxy.git/
synced 2025-09-22 06:11:32 +02:00
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.
This commit is contained in:
parent
1526f1942c
commit
ac73ae0b83
@ -116,9 +116,8 @@ int hpack_encode_header(struct buffer *out, const struct ist n,
|
|||||||
out->area[len++] = 0x5c; // literal with indexing -- name="content-length" (idx 28)
|
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) {
|
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 */
|
out->area[len++] = 0x00; /* literal without indexing -- new name */
|
||||||
|
|
||||||
len = hpack_encode_len(out->area, len, n.len);
|
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;
|
len += n.len;
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
|
Loading…
x
Reference in New Issue
Block a user