]> granicus.if.org Git - vim/commitdiff
patch 8.0.1590: padding in list type wastes memory v8.0.1590
authorBram Moolenaar <Bram@vim.org>
Thu, 8 Mar 2018 20:46:43 +0000 (21:46 +0100)
committerBram Moolenaar <Bram@vim.org>
Thu, 8 Mar 2018 20:46:43 +0000 (21:46 +0100)
Problem:    Padding in list type wastes memory.
Solution:   Reorder struct members to optimize padding. (Dominique Pelle,
            closes #2704)

src/structs.h
src/version.c

index 6979dbc73438dfa2a3a986ef71f97bb434782e46..7dc732c9cdc51c1a829e9b8b223bd754672f403d 100644 (file)
@@ -1260,21 +1260,22 @@ struct listwatch_S
 
 /*
  * Structure to hold info about a list.
+ * Order of members is optimized to reduce padding.
  */
 struct listvar_S
 {
     listitem_T *lv_first;      /* first item, NULL if none */
     listitem_T *lv_last;       /* last item, NULL if none */
-    int                lv_refcount;    /* reference count */
-    int                lv_len;         /* number of items */
     listwatch_T        *lv_watch;      /* first watcher, NULL if none */
-    int                lv_idx;         /* cached index of an item */
     listitem_T *lv_idx_item;   /* when not NULL item at index "lv_idx" */
-    int                lv_copyID;      /* ID used by deepcopy() */
     list_T     *lv_copylist;   /* copied list used by deepcopy() */
-    char       lv_lock;        /* zero, VAR_LOCKED, VAR_FIXED */
     list_T     *lv_used_next;  /* next list in used lists list */
     list_T     *lv_used_prev;  /* previous list in used lists list */
+    int                lv_refcount;    /* reference count */
+    int                lv_len;         /* number of items */
+    int                lv_idx;         /* cached index of an item */
+    int                lv_copyID;      /* ID used by deepcopy() */
+    char       lv_lock;        /* zero, VAR_LOCKED, VAR_FIXED */
 };
 
 /*
index d21b8b1a129be6ac71d7b095264fde5ebce4b3e8..21b9cdc804bbdce93b8239ddca0d47792f855b9b 100644 (file)
@@ -766,6 +766,8 @@ static char *(features[]) =
 
 static int included_patches[] =
 {   /* Add new patch number below this line */
+/**/
+    1590,
 /**/
     1589,
 /**/