Skip to content

Signifcant performance overhead on watching .git folder #129

Description

@dmtrKovalenko

I have been debugging why in some of the folders my plugin fff scan is very contended and sometimes very slow on a large git repo and as appeared the reason is this function

local function watch_gitdir(dir)
-- Stop if there is already a watcher running
if watchers[dir] then return end
---@type userdata
watchers[dir] = vim.loop.new_fs_event()
watchers[dir]:start(
dir,
{ recursive = true },
vim.schedule_wrap(function(...) on_throttled_change(dir, ...) end)
)
state.current_watcher_dir = dir
end

you are setting recursive watcher on the .git folder unconditionally in case of chromium monorepo the .git folder is 64GB and 700k+ object files inside - this exhauses the file system watcher, adds a lot of VFS load and simply unnecessary

Instead you can watch specifically one file .git/index - you can watch exatly one path and keep the exact functionality untouched

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions