perf: is_executable calls fs_access for every file on every reload
维护者通常 1 天内回复
还没有人认领这个 Issue。
评估
- 难度
- 2/5
- 预计耗时
- 1-3 小时
- 新手友好度
- 72/100
- Issue 类型
- 缺陷
- 描述清晰度
- 描述清楚
- 活跃度
- 活跃
- 技术栈
- lua, neovim
- 领域
- devtools, performance
调研方向
首先定位 utils.is_executable 以及所述的两个调用点:新建 FileNode 时,以及 lstat 已经可用的 Explorer:reload 中。检查 stat 如何提供文件类型和执行位,然后将其行为与现有的 fs_access 检查进行比较。完成标准是:没有执行位的普通文件跳过该系统调用,而目录、链接和可执行文件保持当前行为。
由索引模型根据 Issue 内容生成。
描述
Problem
utils.is_executable calls vim.uv.fs_access(path, "X") for:
- every new
FileNode, and - every existing node on every
Explorer:reload.
The node's lstat result is already available at both call sites.
Impact
fs_access costs 7.7µs per call vs 1.9µs for lstat. is_executable is about 11% of reload_explorer on a fully expanded 16.8k-node tree.
Proposed fix
Pass the existing stat into is_executable. A regular file with none of the user, group or other execute bits set can never pass access(X), even as root, so return false without the syscall. Files with execute bits, directories and links still use fs_access, happy to follow up with a PR soon.
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 分钟
- 30 天内合并 PR
- 11
环境准备
- 没有 Dockerfile 或 Docker Compose 文件
- 没有 Pull Request 模板
- 阅读贡献指南
从这里开始
- 先读完整个 Issue,再读项目的贡献指南。
- 在 Issue 下留言说明你要接手 —— 这能避免两个人做同样的事。
- Fork 仓库,在一个分支上完成修改。
- 提交 Pull Request,并在描述里引用这个 Issue 编号。
nvim-tree/nvim-tree.lua 的其他 Issue
-
难度 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可能已有人在做 关联的 PR 仍在进行中或已合并。 未关闭
难度 2/5 1-3 小时 新手友好度 75/100
nvim-tree/nvim-tree.lua#3357 · 1 条评论 ·
维护者通常 1 天内回复
-
documentation PR please
难度 1/5 1 小时以内 新手友好度 65/100
nvim-tree/nvim-tree.lua#3179 · 6 条评论 ·
维护者通常 1 天内回复
-
perf: Filters:custom calls getcwd for every file, even with no custom filters可能已有人在做 @hood 今天认领。 未关闭
难度 2/5 1-3 小时 新手友好度 25/100
nvim-tree/nvim-tree.lua#3386 ·
维护者通常 1 天内回复
查看 nvim-tree/nvim-tree.lua 的全部 Issue
相似的 Issue
-
难度 2/5 1-3 小时 新手友好度 83/100
维护者通常 2 天内回复
-
难度 2/5 1-3 小时 新手友好度 65/100
Balatro-Multiplayer/BalatroMultiplayerPvP#620 ·
维护者通常 1 天内回复
-
bug
难度 2/5 1-3 小时 新手友好度 68/100
-
难度 2/5 1-3 小时 新手友好度 63/100
Balatro-Multiplayer/BalatroMultiplayerAPI#55 ·
维护者通常 2 天内回复
-
难度 2/5 1-3 小时 新手友好度 62/100
silverbulletmd/silverbullet#2231 ·
维护者通常 2 天内回复