[Spice-devel] [PATCH 10/18] worker: RedCompressBuf optimization

Frediano Ziglio fziglio at redhat.com
Mon Sep 26 08:12:43 UTC 2016


Move large buffer field at the end of structure.
Due to the way machine address memory this usually can reduce code size
and make program sligthly faster.
Actually reduce size by 100 bytes.

Signed-off-by: Frediano Ziglio <fziglio at redhat.com>
---
 server/image-encoders.h | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/server/image-encoders.h b/server/image-encoders.h
index 5bad0d4..6542edd 100644
--- a/server/image-encoders.h
+++ b/server/image-encoders.h
@@ -58,6 +58,8 @@ void glz_retention_detach_drawables(GlzImageRetention *ret);
 
 #define RED_COMPRESS_BUF_SIZE (1024 * 64)
 struct RedCompressBuf {
+    RedCompressBuf *send_next;
+
     /* This buffer provide space for compression algorithms.
      * Some algorithms access the buffer as an array of 32 bit words
      * so is defined to make sure is always aligned that way.
@@ -66,7 +68,6 @@ struct RedCompressBuf {
         uint8_t  bytes[RED_COMPRESS_BUF_SIZE];
         uint32_t words[RED_COMPRESS_BUF_SIZE / 4];
     } buf;
-    RedCompressBuf *send_next;
 };
 
 static inline void compress_buf_free(RedCompressBuf *buf)
-- 
2.7.4



More information about the Spice-devel mailing list