perf: Filters:custom calls getcwd for every file, even with no custom filters
Los mantenedores suelen responder en 1 día
Evaluación
- Dificultad
- 2/5
- Tiempo estimado
- 1-3 horas
- Aptitud para principiantes
- 25/100
- Tipo de issue
- Error
- Claridad
- Bien especificado
- Estado de actividad
- Estancado
- Stack tecnológico
- lua, neovim
- Área
- performance
Línea de trabajo
Start with lua/nvim-tree/explorer/filters.lua, especially Filters:custom and Filters:prepare; the issue identifies the repeated vim.uv.cwd() call and proposes resolving it once per directory only when custom patterns exist. Check the existing filtering tests and add coverage for empty and nonempty custom patterns. Done when filtering behavior stays the same and the unnecessary cwd calls are avoided; pull request #3387 is already open for this issue.
Escrito por el modelo de indexación a partir del texto del issue.
Descripción
Problem
Filters:custom calls vim.uv.cwd() for every file that gets scanned, via utils.path_relative(path, vim.uv.cwd()) (lua/nvim-tree/explorer/filters.lua:180). This happens even when filters.custom is empty, the default, so the result is never used.
getcwd is slow on some platforms: about 61µs per call on macOS.
Impact (profile on master)
| Operation | Share of time on this line |
|---|---|
api.tree.expand_all() |
33% |
Explorer:reload_explorer() |
42% |
Proposed fix
- Return early from
Filters:customwhen there are no custom patterns. - Resolve the cwd once per directory in
Filters:prepare, and only when there are custom patterns.
Filtering behaviour stays the same.
Happy to follow up with a PR as soon as I get some time.
Environment: macOS, Nvim v0.13.0-dev, LuaJIT 2.1. Test repo: 16.8k files and folders, 3.1k git status entries (modified, untracked, ignored). Measured headless with vim.uv.hrtime() and the LuaJIT profiler (jit.p).
- Lenguaje dominante
- Lua
- Estrellas
- 8.7k
- Forks
- 642
- Merge medio
- 1 d 4 min
- PR fusionados (30 d)
- 11
Preparar el entorno
- Sin Dockerfile ni archivo de Docker Compose
- Sin plantilla de pull request
- Leer la guía de contribución
Primeros pasos
- Lee el issue completo y luego la guía de contribución del proyecto.
- Comenta en el issue que vas a ocuparte — evita que dos personas hagan lo mismo.
- Haz un fork del repositorio y trabaja en una rama.
- Abre un pull request que haga referencia al número del issue.
Más de nvim-tree/nvim-tree.lua
-
Dificultad 2/5 1-3 horas Aptitud para principiantes 72/100
nvim-tree/nvim-tree.lua#3383 ·
Los mantenedores suelen responder en 1 día
-
Dificultad 2/5 1-3 horas Aptitud para principiantes 77/100
nvim-tree/nvim-tree.lua#3382 ·
Los mantenedores suelen responder en 1 día
-
Dificultad 2/5 1-3 horas Aptitud para principiantes 78/100
nvim-tree/nvim-tree.lua#3381 ·
Los mantenedores suelen responder en 1 día
-
Use vim.Option getters and setters instead of directly settingPosiblemente ocupada Un pull request vinculado a esta issue está abierto o ya se fusionó. Abierto
Dificultad 2/5 1-3 horas Aptitud para principiantes 75/100
nvim-tree/nvim-tree.lua#3357 · 1 comentario ·
Los mantenedores suelen responder en 1 día
-
Migrate To vim.packAbiertodocumentation PR please
Dificultad 1/5 Menos de una hora Aptitud para principiantes 65/100
nvim-tree/nvim-tree.lua#3179 · 6 comentarios ·
Los mantenedores suelen responder en 1 día
Todos los issues de nvim-tree/nvim-tree.lua
Issues similares
-
bug
Dificultad 2/5 1-3 horas Aptitud para principiantes 67/100
Los mantenedores suelen responder en 1 día
-
bug confirmed discord guide:tyrs-watch locale:enUS navigation v0.3.2
Dificultad 2/5 1-3 horas Aptitud para principiantes 67/100
fitzforge/polestar#855 · 1 comentario ·
Los mantenedores suelen responder en 1 día
-
translation
Dificultad 2/5 1-3 horas Aptitud para principiantes 64/100
KristanLaimon/PanelsPlus#16 ·
-
Bug
Dificultad 1/5 Menos de una hora Aptitud para principiantes 91/100
DennisRas/WeeklyKnowledge#164 ·
-
linux 上使用 msvc-wine 无法增量构建Abiertobug
Dificultad 2/5 1-3 horas Aptitud para principiantes 65/100
Los mantenedores suelen responder en 1 día