perf: Filters:custom calls getcwd for every file, even with no custom filters
メンテナーはふだん 1 日以内に返信
評価
- 難易度
- 2/5
- 見積もり時間
- 1〜3時間
- 初心者へのやさしさ
- 25/100
- issue の種類
- バグ
- 明瞭さ
- 明確に書かれている
- 活発さ
- 停滞
- 技術スタック
- lua, neovim
- 領域
- performance
調査の方向性
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.
索引モデルが issue の本文から書いたものです。
説明
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).
- 主要言語
- Lua
- スター
- 8.7k
- フォーク
- 642
- 平均マージ
- 1日 4分
- マージ済み PR(30日)
- 11
環境構築
- Dockerfile・Docker Compose ファイルなし
- プルリクエストのテンプレートなし
- コントリビューションガイドを読む
はじめの一歩
- issue を最後まで読み、次にプロジェクトのコントリビューションガイドを読みます。
- 着手することを issue にコメントします — 二人が同じ作業をするのを防げます。
- リポジトリをフォークし、ブランチを切って変更します。
- issue 番号を参照したプルリクエストを送ります。
nvim-tree/nvim-tree.lua のほかの issue
-
難易度 2/5 1〜3時間 初心者へのやさしさ 72/100
nvim-tree/nvim-tree.lua#3383 ·
メンテナーはふだん 1 日以内に返信
-
難易度 2/5 1〜3時間 初心者へのやさしさ 77/100
nvim-tree/nvim-tree.lua#3382 ·
メンテナーはふだん 1 日以内に返信
-
難易度 2/5 1〜3時間 初心者へのやさしさ 78/100
nvim-tree/nvim-tree.lua#3381 ·
メンテナーはふだん 1 日以内に返信
-
Use vim.Option getters and setters instead of directly setting対応中かも このイシューにリンクされたプルリクエストがオープン中、またはマージ済みです。 オープン
難易度 2/5 1〜3時間 初心者へのやさしさ 75/100
nvim-tree/nvim-tree.lua#3357 · コメント 1 件 ·
メンテナーはふだん 1 日以内に返信
-
Migrate To vim.packオープンdocumentation PR please
難易度 1/5 1時間未満 初心者へのやさしさ 65/100
nvim-tree/nvim-tree.lua#3179 · コメント 6 件 ·
メンテナーはふだん 1 日以内に返信
nvim-tree/nvim-tree.lua の issue をすべて見る
似ている issue
-
bug
難易度 2/5 1〜3時間 初心者へのやさしさ 67/100
メンテナーはふだん 1 日以内に返信
-
bug confirmed discord guide:tyrs-watch locale:enUS navigation v0.3.2
難易度 2/5 1〜3時間 初心者へのやさしさ 67/100
fitzforge/polestar#855 · コメント 1 件 ·
メンテナーはふだん 1 日以内に返信
-
translation
難易度 2/5 1〜3時間 初心者へのやさしさ 64/100
KristanLaimon/PanelsPlus#16 ·
-
Bug
難易度 1/5 1時間未満 初心者へのやさしさ 91/100
DennisRas/WeeklyKnowledge#164 ·
-
bug
難易度 2/5 1〜3時間 初心者へのやさしさ 65/100
メンテナーはふだん 1 日以内に返信