summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorBram Moolenaar <Bram@vim.org>2018-03-08 21:46:43 +0100
committerBram Moolenaar <Bram@vim.org>2018-03-08 21:46:43 +0100
commit1a840240376f2858d489736f9eed6d2975225fdf (patch)
tree22d9099a8df20156816b00ce32916ed8e2953d52
parentd7db27bafd1045281c965d9483539748a744de70 (diff)
downloadvim-git-1a840240376f2858d489736f9eed6d2975225fdf.tar.gz
patch 8.0.1590: padding in list type wastes memoryv8.0.1590
Problem: Padding in list type wastes memory. Solution: Reorder struct members to optimize padding. (Dominique Pelle, closes #2704)
-rw-r--r--src/structs.h11
-rw-r--r--src/version.c2
2 files changed, 8 insertions, 5 deletions
diff --git a/src/structs.h b/src/structs.h
index 6979dbc73..7dc732c9c 100644
--- a/src/structs.h
+++ b/src/structs.h
@@ -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 */
};
/*
diff --git a/src/version.c b/src/version.c
index d21b8b1a1..21b9cdc80 100644
--- a/src/version.c
+++ b/src/version.c
@@ -767,6 +767,8 @@ static char *(features[]) =
static int included_patches[] =
{ /* Add new patch number below this line */
/**/
+ 1590,
+/**/
1589,
/**/
1588,