]> git.ipfire.org Git - thirdparty/haproxy.git/commitdiff
DIET/MINOR: task: reduce struct task size by 8 bytes
authorWilly Tarreau <w@1wt.eu>
Sat, 7 Dec 2013 00:01:39 +0000 (01:01 +0100)
committerWilly Tarreau <w@1wt.eu>
Mon, 9 Dec 2013 15:06:22 +0000 (16:06 +0100)
Just by reordering the struct task, we could shrink it by 8 bytes from
120 to 112 bytes. A careful reordering allowed each part to be located
closer to the hot parts it's used with, resulting in another performance
increase of about 0.5%.

include/types/task.h

index 405404bd0d4cf43ea8d03cf289e8cd57cac1ace8..0379a22b857cf373d2693e30bb0e9a1e98e0cbb7 100644 (file)
 
 /* The base for all tasks */
 struct task {
-       struct eb32_node wq;            /* ebtree node used to hold the task in the wait queue */
        struct eb32_node rq;            /* ebtree node used to hold the task in the run queue */
-       int state;                      /* task state : bit field of TASK_* */
-       int expire;                     /* next expiration date for this task, in ticks */
+       unsigned short state;           /* task state : bit field of TASK_* */
+       short nice;                     /* the task's current nice value from -1024 to +1024 */
        unsigned int calls;             /* number of times ->process() was called */
        struct task * (*process)(struct task *t);  /* the function which processes the task */
        void *context;                  /* the task's context */
-       int nice;                       /* the task's current nice value from -1024 to +1024 */
+       struct eb32_node wq;            /* ebtree node used to hold the task in the wait queue */
+       int expire;                     /* next expiration date for this task, in ticks */
 };
 
 /*