]> git.ipfire.org Git - thirdparty/haproxy.git/commit
OPTIM: http: optimize lookup of comma and quote in header values
authorWilly Tarreau <w@1wt.eu>
Sat, 5 Nov 2016 17:23:38 +0000 (18:23 +0100)
committerWilly Tarreau <w@1wt.eu>
Sat, 5 Nov 2016 17:23:38 +0000 (18:23 +0100)
commite6d9c2105941b300131a9e26a84c0646f979747f
tree6451ab91c70c524733ea526d2daab7f272f4ffff
parent5f10ea30f4a2a3fd32eed0844ab999c6068f7fba
OPTIM: http: optimize lookup of comma and quote in header values

http_find_header2() relies on find_hdr_value_end() to find the comma
delimiting a header field value, which also properly handles double
quotes and backslashes within quotes. In fact double quotes are very
rare, and commas happen once every multiple characters, especially
with cookies where a full block can be found at once. So it makes
sense to optimize this function to speed up the lookup of the first
block before the quote.

This change increases the performance from 212k to 217k req/s when
requests contain a 1kB cookie (+2.5%). We don't care about going
back into the fast parser after the first quote, as it may
needlessly make the parser more complex for very marginal gains.
src/proto_http.c