summaryrefslogtreecommitdiffstats
path: root/src/globals.h
diff options
context:
space:
mode:
authorBram Moolenaar <Bram@vim.org>2020-01-26 19:26:46 +0100
committerBram Moolenaar <Bram@vim.org>2020-01-26 19:26:46 +0100
commit21b9e9773d64de40994f8762173bdd8befa6acf7 (patch)
tree4aa50f453c1dda97881a6bb3153e2246bc4a95ed /src/globals.h
parentb3de5114acdc5859cf068d5fde9d7cb2bb34aa31 (diff)
patch 8.2.0154: reallocating the list of scripts is inefficientv8.2.0154
Problem: Reallocating the list of scripts is inefficient. Solution: Instead of using a growarray of scriptitem_T, store pointers and allocate each scriptitem_T separately. Also avoids that the growarray pointers change when sourcing a new script.
Diffstat (limited to 'src/globals.h')
-rw-r--r--src/globals.h6
1 files changed, 3 insertions, 3 deletions
diff --git a/src/globals.h b/src/globals.h
index 6a73bc135f..b40eb2a85f 100644
--- a/src/globals.h
+++ b/src/globals.h
@@ -285,9 +285,9 @@ EXTERN int debug_backtrace_level INIT(= 0); // breakpoint backtrace level
# ifdef FEAT_PROFILE
EXTERN int do_profiling INIT(= PROF_NONE); // PROF_ values
# endif
-EXTERN garray_T script_items INIT5(0, 0, sizeof(scriptitem_T), 4, NULL);
-# define SCRIPT_ITEM(id) (((scriptitem_T *)script_items.ga_data)[(id) - 1])
-# define SCRIPT_SV(id) (SCRIPT_ITEM(id).sn_vars)
+EXTERN garray_T script_items INIT5(0, 0, sizeof(scriptitem_T *), 20, NULL);
+# define SCRIPT_ITEM(id) (((scriptitem_T **)script_items.ga_data)[(id) - 1])
+# define SCRIPT_SV(id) (SCRIPT_ITEM(id)->sn_vars)
# define SCRIPT_VARS(id) (SCRIPT_SV(id)->sv_dict.dv_hashtab)
# define FUNCLINE(fp, j) ((char_u **)(fp->uf_lines.ga_data))[j]