mirror of
http://git.haproxy.org/git/haproxy.git
synced 2026-02-20 20:13:32 +02:00
The current guid struct size is 56 bytes. Once reduced using compact
trees, it goes down to 32 (almost half). We're not on a critical path
and size matters here, so better switch to this.
It's worth noting that the name part could also be stored in the
guid_node at the end to save 8 extra byte (no pointer needed anymore),
however the purpose of this struct is to be embedded into other ones,
which is not compatible with having a dynamic size.
Affected struct sizes in bytes:
Before After Diff
server 4032 4032 0*
proxy 3184 3160 -24
listener 752 728 -24
*: struct server is full of holes and padding (176 bytes) and is
64-byte aligned. Moving the guid_node elsewhere such as after sess_conn
reduces it to 3968, or one less cache line. There's no point in moving
anything now because forthcoming patches will arrange other parts.
17 lines
411 B
C
17 lines
411 B
C
#ifndef _HAPROXY_GUID_T_H
|
|
#define _HAPROXY_GUID_T_H
|
|
|
|
#include <import/cebtree.h>
|
|
#include <haproxy/obj_type-t.h>
|
|
|
|
/* Maximum GUID size excluding final '\0' */
|
|
#define GUID_MAX_LEN 127
|
|
|
|
struct guid_node {
|
|
struct ceb_node node; /* attach point into GUID global tree */
|
|
char *key; /* the key itself */
|
|
enum obj_type *obj_type; /* pointer to GUID obj owner */
|
|
};
|
|
|
|
#endif /* _HAPROXY_GUID_T_H */
|