aboutsummaryrefslogtreecommitdiff
path: root/src/nvim/api/vim.c
diff options
context:
space:
mode:
authorLewis Russell <lewis6991@gmail.com>2023-07-13 10:17:19 +0100
committerGitHub <noreply@github.com>2023-07-13 10:17:19 +0100
commit516b173780e39de3ce1e4525f0a8f0ff250c992b (patch)
treeafd6b0148b9a02e1e33859aa437b9348024ec5a3 /src/nvim/api/vim.c
parent998bebc15e9de70b3daaaa5900e974dea5abda3e (diff)
downloadrneovim-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/api/vim.c')
-rw-r--r--src/nvim/api/vim.c11
1 files changed, 8 insertions, 3 deletions
diff --git a/src/nvim/api/vim.c b/src/nvim/api/vim.c
index c15ec4ce53..b1e472aa8c 100644
--- a/src/nvim/api/vim.c
+++ b/src/nvim/api/vim.c
@@ -527,12 +527,17 @@ ArrayOf(String) nvim_get_runtime_file(String name, Boolean all, Error *err)
return rv;
}
-static void find_runtime_cb(char *fname, void *cookie)
+static bool find_runtime_cb(int num_fnames, char **fnames, bool all, void *cookie)
{
Array *rv = (Array *)cookie;
- if (fname != NULL) {
- ADD(*rv, CSTR_TO_OBJ(fname));
+ for (int i = 0; i < num_fnames; i++) {
+ ADD(*rv, CSTR_TO_OBJ(fnames[i]));
+ if (!all) {
+ return true;
+ }
}
+
+ return num_fnames > 0;
}
String nvim__get_lib_dir(void)