OPTIM: http: move all http character classs tables into a single one
We used to have 7 different character classes, each was 256 bytes long,
resulting in almost 2kB being used in the L1 cache. It's as cheap to
test a bit than to check the byte is not null, so let's store a 7-bit
composite value and check for the respective bits there instead.
The executable is now 4 kB smaller and the performance on small
objects increased by about 1% to 222k requests/second with a config
involving 4 http-request rules including 1 header lookup, one header
replacement, and 2 variable assignments.
diff --git a/src/sample.c b/src/sample.c
index 77cbd1b..1438ca1 100644
--- a/src/sample.c
+++ b/src/sample.c
@@ -2570,7 +2570,7 @@
* token = 1*tchar
*/
for (i = 0; i < args[0].data.str.len; i++) {
- if (!http_is_token[(unsigned char)args[0].data.str.str[i]]) {
+ if (!HTTP_IS_TOKEN(args[0].data.str.str[i])) {
memprintf(err, "expects valid method.");
return 0;
}