]> git.ipfire.org Git - thirdparty/haproxy.git/commitdiff
OPTIM: channel: reorganize struct members to improve cache efficiency
authorWilly Tarreau <w@1wt.eu>
Sat, 13 Oct 2012 08:05:56 +0000 (10:05 +0200)
committerWilly Tarreau <w@1wt.eu>
Sat, 13 Oct 2012 08:55:22 +0000 (10:55 +0200)
Now that the buffer is moved out of the channel, it is possible to move
the pointer earlier in the struct and reorder some fields. This new
ordering improves overall performance by 2%, mainly saved in the HTTP
parsers and data transfers.

include/types/channel.h

index efd1a128c1f96952217be5b009c0e146fd78ed90..778339a14e2c12dc370f07b160ad941bd4bd9df3 100644 (file)
@@ -172,21 +172,21 @@ struct session;
 
 struct channel {
        unsigned int flags;             /* CF_* */
+       unsigned int analysers;         /* bit field indicating what to do on the channel */
+       struct buffer *buf;             /* buffer attached to the channel, always present but may move */
+       struct stream_interface *cons;  /* consumer attached to this channel */
+       struct stream_interface *prod;  /* producer attached to this channel */
+       struct pipe *pipe;              /* non-NULL only when data present */
+       unsigned int to_forward;        /* number of bytes to forward after out without a wake-up */
+       unsigned char xfer_large;       /* number of consecutive large xfers */
+       unsigned char xfer_small;       /* number of consecutive small xfers */
+       unsigned long long total;       /* total data read */
        int rex;                        /* expiration date for a read, in ticks */
        int wex;                        /* expiration date for a write or connect, in ticks */
        int rto;                        /* read timeout, in ticks */
        int wto;                        /* write timeout, in ticks */
-       unsigned int to_forward;        /* number of bytes to forward after out without a wake-up */
-       unsigned int analysers;         /* bit field indicating what to do on the channel */
-       int analyse_exp;                /* expiration date for current analysers (if set) */
        void (*hijacker)(struct session *, struct channel *); /* alternative content producer */
-       unsigned char xfer_large;       /* number of consecutive large xfers */
-       unsigned char xfer_small;       /* number of consecutive small xfers */
-       unsigned long long total;       /* total data read */
-       struct stream_interface *prod;  /* producer attached to this channel */
-       struct stream_interface *cons;  /* consumer attached to this channel */
-       struct pipe *pipe;              /* non-NULL only when data present */
-       struct buffer *buf;             /* buffer attached to the channel, always present but may move */
+       int analyse_exp;                /* expiration date for current analysers (if set) */
 };