To: vim_dev@googlegroups.com Subject: Patch 8.0.1590 Fcc: outbox From: Bram Moolenaar Mime-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit ------------ Patch 8.0.1590 Problem: Padding in list type wastes memory. Solution: Reorder struct members to optimize padding. (Dominique Pelle, closes #2704) Files: src/structs.h *** ../vim-8.0.1589/src/structs.h 2018-03-04 20:14:08.256064288 +0100 --- src/structs.h 2018-03-08 21:46:16.602881941 +0100 *************** *** 1260,1280 **** /* * Structure to hold info about a list. */ 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 */ }; /* --- 1260,1281 ---- /* * 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 */ listwatch_T *lv_watch; /* first watcher, NULL if none */ listitem_T *lv_idx_item; /* when not NULL item at index "lv_idx" */ list_T *lv_copylist; /* copied list used by deepcopy() */ 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 */ }; /* *** ../vim-8.0.1589/src/version.c 2018-03-07 23:02:29.594336432 +0100 --- src/version.c 2018-03-08 21:46:25.166824549 +0100 *************** *** 768,769 **** --- 768,771 ---- { /* Add new patch number below this line */ + /**/ + 1590, /**/ -- Our job was to build a computer information system for the branch banks. We were the perfect people for the job: Dean had seen a computer once, and I had heard Dean talk about it. (Scott Adams - The Dilbert principle) /// Bram Moolenaar -- Bram@Moolenaar.net -- http://www.Moolenaar.net \\\ /// sponsor Vim, vote for features -- http://www.Vim.org/sponsor/ \\\ \\\ an exciting new programming language -- http://www.Zimbu.org /// \\\ help me help AIDS victims -- http://ICCF-Holland.org ///