mirror of
https://github.com/neovim/neovim.git
synced 2024-12-20 11:15:14 -07:00
vim-patch:8.0.1590: padding in list type wastes memory (#9119)
Problem: Padding in list type wastes memory.
Solution: Reorder struct members to optimize padding. (Dominique Pelle,
closes vim/vim#2704)
1a84024037
This commit is contained in:
parent
bddcbbb571
commit
824f36a980
@ -162,19 +162,20 @@ 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; ///< Index of a cached item, used for optimising repeated l[idx].
|
||||
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().
|
||||
VarLockStatus 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; ///< Index of a cached item, used for optimising repeated l[idx].
|
||||
int lv_copyID; ///< ID used by deepcopy().
|
||||
VarLockStatus lv_lock; ///< Zero, VAR_LOCKED, VAR_FIXED.
|
||||
};
|
||||
|
||||
// Static list with 10 items. Use tv_list_init_static10() to initialize.
|
||||
|
Loading…
Reference in New Issue
Block a user