diff options
author | Lewis Russell <lewis6991@gmail.com> | 2023-07-13 10:17:19 +0100 |
---|---|---|
committer | GitHub <noreply@github.com> | 2023-07-13 10:17:19 +0100 |
commit | 516b173780e39de3ce1e4525f0a8f0ff250c992b (patch) | |
tree | afd6b0148b9a02e1e33859aa437b9348024ec5a3 /src/nvim/tag.c | |
parent | 998bebc15e9de70b3daaaa5900e974dea5abda3e (diff) | |
download | rneovim-516b173780e39de3ce1e4525f0a8f0ff250c992b.tar.gz rneovim-516b173780e39de3ce1e4525f0a8f0ff250c992b.tar.bz2 rneovim-516b173780e39de3ce1e4525f0a8f0ff250c992b.zip |
perf(rtp): reduce rtp scans (#24191)
* perf(rtp): reduce rtp scans
Problem:
Scanning the filesystem is expensive and particularly affects
startuptime.
Solution:
Reduce the amount of redundant directory scans by relying less on glob
patterns and handle vim and lua sourcing lower down.
Diffstat (limited to 'src/nvim/tag.c')
-rw-r--r-- | src/nvim/tag.c | 18 |
1 files changed, 13 insertions, 5 deletions
diff --git a/src/nvim/tag.c b/src/nvim/tag.c index d1f4903294..8bbfb663bd 100644 --- a/src/nvim/tag.c +++ b/src/nvim/tag.c @@ -2482,15 +2482,23 @@ static garray_T tag_fnames = GA_EMPTY_INIT_VALUE; // Callback function for finding all "tags" and "tags-??" files in // 'runtimepath' doc directories. -static void found_tagfile_cb(char *fname, void *cookie) +static bool found_tagfile_cb(int num_fnames, char **fnames, bool all, void *cookie) { - char *const tag_fname = xstrdup(fname); + for (int i = 0; i < num_fnames; i++) { + char *const tag_fname = xstrdup(fnames[i]); #ifdef BACKSLASH_IN_FILENAME - slash_adjust(tag_fname); + slash_adjust(tag_fname); #endif - simplify_filename(tag_fname); - GA_APPEND(char *, &tag_fnames, tag_fname); + simplify_filename(tag_fname); + GA_APPEND(char *, &tag_fnames, tag_fname); + + if (!all) { + break; + } + } + + return num_fnames > 0; } #if defined(EXITFREE) |