mirror of
https://git.haproxy.org/git/haproxy.git/
synced 2025-12-08 11:11:01 +01:00
DIET/MINOR: http: reduce the size of struct http_txn by 8 bytes
Here again we had some oversized and misaligned entries. The method and the status don't need 4 bytes each, and there was a hole after the status that does not exist anymore. That's 8 additional bytes saved from http_txn and as much for the session. Also some fields were slightly moved to present better memory access patterns resulting in a steady 0.5% performance increase.
This commit is contained in:
parent
721854f0ac
commit
c8987b3664
@ -217,7 +217,7 @@ enum {
|
||||
};
|
||||
|
||||
/* Known HTTP methods */
|
||||
typedef enum {
|
||||
enum http_meth_t {
|
||||
HTTP_METH_NONE = 0,
|
||||
HTTP_METH_OPTIONS,
|
||||
HTTP_METH_GET,
|
||||
@ -228,7 +228,7 @@ typedef enum {
|
||||
HTTP_METH_TRACE,
|
||||
HTTP_METH_CONNECT,
|
||||
HTTP_METH_OTHER,
|
||||
} http_meth_t;
|
||||
} __attribute__((packed));
|
||||
|
||||
enum {
|
||||
HTTP_AUTH_WRONG = -1, /* missing or unknown */
|
||||
@ -405,13 +405,13 @@ struct http_res_rule {
|
||||
* response message (which can be empty).
|
||||
*/
|
||||
struct http_txn {
|
||||
struct http_msg req; /* HTTP request message */
|
||||
struct hdr_idx hdr_idx; /* array of header indexes (max: global.tune.max_http_hdr) */
|
||||
unsigned int flags; /* transaction flags */
|
||||
http_meth_t meth; /* HTTP method */
|
||||
|
||||
int status; /* HTTP status from the server, negative if from proxy */
|
||||
struct http_msg rsp; /* HTTP response message */
|
||||
struct http_msg req; /* HTTP request message */
|
||||
unsigned int flags; /* transaction flags */
|
||||
enum http_meth_t meth; /* HTTP method */
|
||||
/* 1 unused byte here */
|
||||
short status; /* HTTP status from the server, negative if from proxy */
|
||||
|
||||
char *uri; /* first line if log needed, NULL otherwise */
|
||||
char *cli_cookie; /* cookie presented by the client, in capture mode */
|
||||
|
||||
@ -294,7 +294,7 @@ void init_proto_http()
|
||||
* up to 3 entries (2 valid, 1 null).
|
||||
*/
|
||||
struct http_method_desc {
|
||||
http_meth_t meth;
|
||||
enum http_meth_t meth;
|
||||
int len;
|
||||
const char text[8];
|
||||
};
|
||||
@ -767,7 +767,7 @@ struct chunk *http_error_message(struct session *s, int msgnum)
|
||||
* returns HTTP_METH_NONE if there is nothing valid to read (empty or non-text
|
||||
* string), HTTP_METH_OTHER for unknown methods, or the identified method.
|
||||
*/
|
||||
static http_meth_t find_http_meth(const char *str, const int len)
|
||||
static enum http_meth_t find_http_meth(const char *str, const int len)
|
||||
{
|
||||
unsigned char m;
|
||||
const struct http_method_desc *h;
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user