Mercurial > vim
comparison src/structs.h @ 13431:19f9b74a424e v8.0.1590
patch 8.0.1590: padding in list type wastes memory
commit https://github.com/vim/vim/commit/1a840240376f2858d489736f9eed6d2975225fdf
Author: Bram Moolenaar <Bram@vim.org>
Date: Thu Mar 8 21:46:43 2018 +0100
patch 8.0.1590: padding in list type wastes memory
Problem: Padding in list type wastes memory.
Solution: Reorder struct members to optimize padding. (Dominique Pelle,
closes #2704)
author | Christian Brabandt <cb@256bit.org> |
---|---|
date | Thu, 08 Mar 2018 22:00:05 +0100 |
parents | 6740c499de13 |
children | fa198b71bab2 |
comparison
equal
deleted
inserted
replaced
13430:6083ee98c089 | 13431:19f9b74a424e |
---|---|
1258 listwatch_T *lw_next; /* next watcher */ | 1258 listwatch_T *lw_next; /* next watcher */ |
1259 }; | 1259 }; |
1260 | 1260 |
1261 /* | 1261 /* |
1262 * Structure to hold info about a list. | 1262 * Structure to hold info about a list. |
1263 * Order of members is optimized to reduce padding. | |
1263 */ | 1264 */ |
1264 struct listvar_S | 1265 struct listvar_S |
1265 { | 1266 { |
1266 listitem_T *lv_first; /* first item, NULL if none */ | 1267 listitem_T *lv_first; /* first item, NULL if none */ |
1267 listitem_T *lv_last; /* last item, NULL if none */ | 1268 listitem_T *lv_last; /* last item, NULL if none */ |
1269 listwatch_T *lv_watch; /* first watcher, NULL if none */ | |
1270 listitem_T *lv_idx_item; /* when not NULL item at index "lv_idx" */ | |
1271 list_T *lv_copylist; /* copied list used by deepcopy() */ | |
1272 list_T *lv_used_next; /* next list in used lists list */ | |
1273 list_T *lv_used_prev; /* previous list in used lists list */ | |
1268 int lv_refcount; /* reference count */ | 1274 int lv_refcount; /* reference count */ |
1269 int lv_len; /* number of items */ | 1275 int lv_len; /* number of items */ |
1270 listwatch_T *lv_watch; /* first watcher, NULL if none */ | |
1271 int lv_idx; /* cached index of an item */ | 1276 int lv_idx; /* cached index of an item */ |
1272 listitem_T *lv_idx_item; /* when not NULL item at index "lv_idx" */ | |
1273 int lv_copyID; /* ID used by deepcopy() */ | 1277 int lv_copyID; /* ID used by deepcopy() */ |
1274 list_T *lv_copylist; /* copied list used by deepcopy() */ | |
1275 char lv_lock; /* zero, VAR_LOCKED, VAR_FIXED */ | 1278 char lv_lock; /* zero, VAR_LOCKED, VAR_FIXED */ |
1276 list_T *lv_used_next; /* next list in used lists list */ | |
1277 list_T *lv_used_prev; /* previous list in used lists list */ | |
1278 }; | 1279 }; |
1279 | 1280 |
1280 /* | 1281 /* |
1281 * Static list with 10 items. Use init_static_list() to initialize. | 1282 * Static list with 10 items. Use init_static_list() to initialize. |
1282 */ | 1283 */ |