mirror of
https://github.com/neovim/neovim.git
synced 2025-10-06 01:46:29 +00:00
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.
This commit is contained in:
@@ -697,20 +697,8 @@ int load_colors(char *name)
|
||||
size_t buflen = strlen(name) + 12;
|
||||
char *buf = xmalloc(buflen);
|
||||
apply_autocmds(EVENT_COLORSCHEMEPRE, name, curbuf->b_fname, false, curbuf);
|
||||
snprintf(buf, buflen, "colors/%s.vim", name);
|
||||
int retval = source_runtime(buf, 0);
|
||||
if (retval == FAIL) {
|
||||
snprintf(buf, buflen, "colors/%s.lua", name);
|
||||
retval = source_runtime(buf, 0);
|
||||
}
|
||||
if (retval == FAIL) {
|
||||
snprintf(buf, buflen, "colors/%s.vim", name);
|
||||
retval = source_runtime(buf, DIP_NORTP + DIP_START + DIP_OPT);
|
||||
}
|
||||
if (retval == FAIL) {
|
||||
snprintf(buf, buflen, "colors/%s.lua", name);
|
||||
retval = source_runtime(buf, DIP_NORTP + DIP_START + DIP_OPT);
|
||||
}
|
||||
snprintf(buf, buflen, "colors/%s.*", name);
|
||||
int retval = source_runtime_vim_lua(buf, DIP_START + DIP_OPT);
|
||||
xfree(buf);
|
||||
if (retval == OK) {
|
||||
apply_autocmds(EVENT_COLORSCHEME, name, curbuf->b_fname, false, curbuf);
|
||||
|
Reference in New Issue
Block a user