perf: Filters:custom calls getcwd for every file, even with no custom filters
Maintainer thường phản hồi trong vòng 1 ngày
Đánh giá
- Độ khó
- 2/5
- Thời gian dự kiến
- 1-3 giờ
- Mức phù hợp với người mới
- 25/100
- Loại issue
- Lỗi
- Độ rõ ràng
- Đặc tả rõ ràng
- Mức độ hoạt động
- Đình trệ
- Công nghệ
- lua, neovim
- Lĩnh vực
- performance
Hướng nghiên cứu
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.
Do mô hình lập chỉ mục viết ra từ nội dung của issue.
Mô tả
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).
- Ngôn ngữ chính
- Lua
- Star
- 8.7k
- Fork
- 642
- Merge trung bình
- 1 ngày 4 phút
- Pull request đã merge (30 ngày)
- 11
Chuẩn bị môi trường
- Không có Dockerfile hay tệp Docker Compose
- Không có mẫu pull request
- Đọc hướng dẫn đóng góp
Bắt đầu từ đâu
- Đọc hết issue, rồi đọc hướng dẫn đóng góp của dự án.
- Bình luận trên issue rằng bạn sẽ nhận — tránh hai người làm cùng một việc.
- Fork repository và làm thay đổi trên một nhánh.
- Mở pull request có tham chiếu số hiệu của issue.
Issue khác của nvim-tree/nvim-tree.lua
-
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 72/100
nvim-tree/nvim-tree.lua#3383 ·
Maintainer thường phản hồi trong vòng 1 ngày
-
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 77/100
nvim-tree/nvim-tree.lua#3382 ·
Maintainer thường phản hồi trong vòng 1 ngày
-
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 78/100
nvim-tree/nvim-tree.lua#3381 ·
Maintainer thường phản hồi trong vòng 1 ngày
-
Use vim.Option getters and setters instead of directly settingCó thể đã có người làm Có pull request liên kết đang mở hoặc đã được merge. Đang mở
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 75/100
nvim-tree/nvim-tree.lua#3357 · 1 bình luận ·
Maintainer thường phản hồi trong vòng 1 ngày
-
Migrate To vim.packĐang mởdocumentation PR please
Độ khó 1/5 Dưới một giờ Mức phù hợp với người mới 65/100
nvim-tree/nvim-tree.lua#3179 · 6 bình luận ·
Maintainer thường phản hồi trong vòng 1 ngày
Tất cả issue của nvim-tree/nvim-tree.lua
Issue tương tự
-
bug
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 67/100
Maintainer thường phản hồi trong vòng 1 ngày
-
bug confirmed discord guide:tyrs-watch locale:enUS navigation v0.3.2
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 67/100
fitzforge/polestar#855 · 1 bình luận ·
Maintainer thường phản hồi trong vòng 1 ngày
-
translation
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 64/100
KristanLaimon/PanelsPlus#16 ·
-
Bug
Độ khó 1/5 Dưới một giờ Mức phù hợp với người mới 91/100
DennisRas/WeeklyKnowledge#164 ·
-
bug
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 68/100
Maintainer thường phản hồi trong vòng 1 ngày