diff options
author | Bram Moolenaar <Bram@vim.org> | 2020-01-26 19:26:46 +0100 |
---|---|---|
committer | Bram Moolenaar <Bram@vim.org> | 2020-01-26 19:26:46 +0100 |
commit | 21b9e9773d64de40994f8762173bdd8befa6acf7 (patch) | |
tree | 4aa50f453c1dda97881a6bb3153e2246bc4a95ed /src/profiler.c | |
parent | b3de5114acdc5859cf068d5fde9d7cb2bb34aa31 (diff) | |
download | vim-git-21b9e9773d64de40994f8762173bdd8befa6acf7.tar.gz |
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/profiler.c')
-rw-r--r-- | src/profiler.c | 14 |
1 files changed, 7 insertions, 7 deletions
diff --git a/src/profiler.c b/src/profiler.c index cd962cabd..647934d52 100644 --- a/src/profiler.c +++ b/src/profiler.c @@ -440,7 +440,7 @@ prof_inchar_exit(void) prof_def_func(void) { if (current_sctx.sc_sid > 0) - return SCRIPT_ITEM(current_sctx.sc_sid).sn_pr_force; + return SCRIPT_ITEM(current_sctx.sc_sid)->sn_pr_force; return FALSE; } @@ -763,7 +763,7 @@ script_prof_save( if (current_sctx.sc_sid > 0 && current_sctx.sc_sid <= script_items.ga_len) { - si = &SCRIPT_ITEM(current_sctx.sc_sid); + si = SCRIPT_ITEM(current_sctx.sc_sid); if (si->sn_prof_on && si->sn_pr_nest++ == 0) profile_start(&si->sn_pr_child); } @@ -780,7 +780,7 @@ script_prof_restore(proftime_T *tm) if (current_sctx.sc_sid > 0 && current_sctx.sc_sid <= script_items.ga_len) { - si = &SCRIPT_ITEM(current_sctx.sc_sid); + si = SCRIPT_ITEM(current_sctx.sc_sid); if (si->sn_prof_on && --si->sn_pr_nest == 0) { profile_end(&si->sn_pr_child); @@ -805,7 +805,7 @@ script_dump_profile(FILE *fd) for (id = 1; id <= script_items.ga_len; ++id) { - si = &SCRIPT_ITEM(id); + si = SCRIPT_ITEM(id); if (si->sn_prof_on) { fprintf(fd, "SCRIPT %s\n", si->sn_name); @@ -905,7 +905,7 @@ script_line_start(void) if (current_sctx.sc_sid <= 0 || current_sctx.sc_sid > script_items.ga_len) return; - si = &SCRIPT_ITEM(current_sctx.sc_sid); + si = SCRIPT_ITEM(current_sctx.sc_sid); if (si->sn_prof_on && SOURCING_LNUM >= 1) { // Grow the array before starting the timer, so that the time spent @@ -940,7 +940,7 @@ script_line_exec(void) if (current_sctx.sc_sid <= 0 || current_sctx.sc_sid > script_items.ga_len) return; - si = &SCRIPT_ITEM(current_sctx.sc_sid); + si = SCRIPT_ITEM(current_sctx.sc_sid); if (si->sn_prof_on && si->sn_prl_idx >= 0) si->sn_prl_execed = TRUE; } @@ -956,7 +956,7 @@ script_line_end(void) if (current_sctx.sc_sid <= 0 || current_sctx.sc_sid > script_items.ga_len) return; - si = &SCRIPT_ITEM(current_sctx.sc_sid); + si = SCRIPT_ITEM(current_sctx.sc_sid); if (si->sn_prof_on && si->sn_prl_idx >= 0 && si->sn_prl_idx < si->sn_prl_ga.ga_len) { |