perf: is_executable calls fs_access for every file on every reload

オープン 初心者向け
#3,383 コメント 0 件 リアクション 0 件 担当者 0 名 GitHub で見る

メンテナーはふだん 1 日以内に返信

まだ誰も着手していません。

評価

難易度
2/5
見積もり時間
1〜3時間
初心者へのやさしさ
72/100
issue の種類
バグ
明瞭さ
明確に書かれている
活発さ
活発
技術スタック
lua, neovim

調査の方向性

まず utils.is_executable と、説明されている2つの呼び出し箇所、すなわち新しい 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分
マージ済み PR(30日)
11

環境構築

はじめの一歩

  1. issue を最後まで読み、次にプロジェクトのコントリビューションガイドを読みます。
  2. 着手することを issue にコメントします — 二人が同じ作業をするのを防げます。
  3. リポジトリをフォークし、ブランチを切って変更します。
  4. issue 番号を参照したプルリクエストを送ります。

nvim-tree/nvim-tree.lua のほかの issue

nvim-tree/nvim-tree.lua の issue をすべて見る

似ている issue

Lua の issue をもっと見る

新しい issue をメールで受け取る

初心者向けの GitHub issue を短くまとめたダイジェスト。