To: vim_dev@googlegroups.com Subject: Patch 8.0.1541 Fcc: outbox From: Bram Moolenaar Mime-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit ------------ Patch 8.0.1541 Problem: synpat_T is taking too much memory. Solution: Reorder members to reduce padding. (Dominique Pelle, closes #2671) Files: src/syntax.c *** ../vim-8.0.1540/src/syntax.c 2018-02-22 21:06:44.566818882 +0100 --- src/syntax.c 2018-02-24 21:35:50.310399352 +0100 *************** *** 145,174 **** * * A character offset can be given for the matched text (_m_start and _m_end) * and for the actually highlighted text (_h_start and _h_end). */ typedef struct syn_pattern { char sp_type; /* see SPTYPE_ defines below */ char sp_syncing; /* this item used for syncing */ int sp_flags; /* see HL_ defines below */ #ifdef FEAT_CONCEAL int sp_cchar; /* conceal substitute character */ #endif struct sp_syn sp_syn; /* struct passed to in_id_list() */ - short sp_syn_match_id; /* highlight group ID of pattern */ char_u *sp_pattern; /* regexp to match, pattern */ regprog_T *sp_prog; /* regexp to match, program */ #ifdef FEAT_PROFILE syn_time_T sp_time; #endif - int sp_ic; /* ignore-case flag for sp_prog */ - short sp_off_flags; /* see below */ - int sp_offsets[SPO_COUNT]; /* offsets */ - short *sp_cont_list; /* cont. group IDs, if non-zero */ - short *sp_next_list; /* next group IDs, if non-zero */ - int sp_sync_idx; /* sync item index (syncing only) */ - int sp_line_id; /* ID of last line where tried */ - int sp_startcol; /* next match in sp_line_id line */ } synpat_T; /* The sp_off_flags are computed like this: --- 145,176 ---- * * A character offset can be given for the matched text (_m_start and _m_end) * and for the actually highlighted text (_h_start and _h_end). + * + * Note that ordering of members is optimized to reduce padding. */ typedef struct syn_pattern { char sp_type; /* see SPTYPE_ defines below */ char sp_syncing; /* this item used for syncing */ + short sp_syn_match_id; /* highlight group ID of pattern */ + short sp_off_flags; /* see below */ + int sp_offsets[SPO_COUNT]; /* offsets */ int sp_flags; /* see HL_ defines below */ #ifdef FEAT_CONCEAL int sp_cchar; /* conceal substitute character */ #endif + int sp_ic; /* ignore-case flag for sp_prog */ + int sp_sync_idx; /* sync item index (syncing only) */ + int sp_line_id; /* ID of last line where tried */ + int sp_startcol; /* next match in sp_line_id line */ + short *sp_cont_list; /* cont. group IDs, if non-zero */ + short *sp_next_list; /* next group IDs, if non-zero */ struct sp_syn sp_syn; /* struct passed to in_id_list() */ char_u *sp_pattern; /* regexp to match, pattern */ regprog_T *sp_prog; /* regexp to match, program */ #ifdef FEAT_PROFILE syn_time_T sp_time; #endif } synpat_T; /* The sp_off_flags are computed like this: *** ../vim-8.0.1540/src/version.c 2018-02-24 21:25:25.202496627 +0100 --- src/version.c 2018-02-24 21:35:11.586652167 +0100 *************** *** 780,781 **** --- 780,783 ---- { /* Add new patch number below this line */ + /**/ + 1541, /**/ -- Sometimes I think the surest sign that intelligent life exists elsewhere in the universe is that none of it has tried to contact us. (Calvin) /// 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 ///