Skip to content

Performance issue when working with telescope #1844

Closed
@ghostbuster91

Description

@ghostbuster91

Description

First of all, thank you very much for this great plugin, I appreciate your effort.

After a recent update I started to observe some performance issues when switching files using telescope. After some debugging it turned out that this is only occurs if I had nvim-tree opened. The issue goes away when I disable git integration. However I don't think that this is solely related to git. The repository I work on is big, sure, but picking files using telescope shouldn't be affected by nvim-tree, as there is nothing that nvim-tree should be doing with that information.

No delay:
nvim-tree-old
Here you can observe the delay:
nvim-tree-new

Neovim version

nvim --version
NVIM v0.8.1
Build type: Release
LuaJIT 2.1.0-beta3
Compiled by nixbld

Features: +acl +iconv +tui
See ":help feature-compile"

   system vimrc file: "$VIM/sysinit.vim"
  fall-back for $VIM: "
/nix/store/zfyninsb38hzxkx3rxvwz3lxdxnsfz0j-neovim-unwrapped-0.8.1/share/nvim
"

Run :checkhealth for more info

Operating system and version

Linux PCX0DX 5.15.0-56-generic #62~20.04.1-Ubuntu SMP Tue Nov 22 21:24:20 UTC 2022 x86_64 x86_64 x86_64 GNU/Linux

nvim-tree version

87409bb

Minimal config

vim.cmd [[set runtimepath=$VIMRUNTIME]]
vim.cmd [[set packpath=/tmp/nvt-min/site]]
local package_root = "/tmp/nvt-min/site/pack"
local install_path = package_root .. "/packer/start/packer.nvim"
local function load_plugins()
  require("packer").startup({ function(use)
    use {"wbthomason/packer.nvim"}
    use {"nvim-tree/nvim-tree.lua",
	commit = '87409bb4afd0093193e1364faa47327fbfdfca87'
    }
    use {"nvim-tree/nvim-web-devicons"}
    use {'nvim-telescope/telescope.nvim', 
         commit = 'cabf991b1d3996fa6f3232327fc649bbdf676496',
         requires = { {'nvim-lua/plenary.nvim'} }
	}
  end
  ,
    config = {
      package_root = package_root,
      compile_path = install_path .. "/plugin/packer_compiled.lua",
      display = { non_interactive = true },
}
    })
end
if vim.fn.isdirectory(install_path) == 0 then
  print "Installing nvim-tree and dependencies."
  vim.fn.system { "git", "clone", "--depth=1", "https://github.com/wbthomason/packer.nvim", install_path }
end
load_plugins()
require("packer").sync()
vim.cmd [[autocmd User PackerComplete ++once echo "Ready!" | lua setup()]]
vim.opt.termguicolors = true
vim.opt.cursorline = true

-- MODIFY NVIM-TREE SETTINGS THAT ARE _NECESSARY_ FOR REPRODUCING THE ISSUE
_G.setup = function()
  require("nvim-tree").setup {}
  require("telescope").setup{}
end

Steps to reproduce

  1. nvim -nu /tmp/nvt-min.lua
  2. open a big repository like e.g. https://github.com/NixOS/nixpkg
  3. open few files using telescope picker - no issue here
  4. toggle nvim-tree
  5. repeat step 3. - huge lags when opening new files

Expected behavior

As there is nothing that interacts with nvim tree during this workflow I would expect it not to cause any delays.

Actual behavior

Opening telescope incurs a delay as well as opening new file using it.
In the logs I can see multiple such blocks:

!! .idea/
!! nixpkgs.iml
[2022-12-19 19:19:26] [git] done
[2022-12-19 19:19:26] [profile] END   git job /home/kghost/workspace/nixpkgs nil  134ms
[2022-12-19 19:19:26] [git] job success    /home/kghost/workspace/nixpkgs nil
[2022-12-19 19:19:26] [profile] START reload /home/kghost/workspace/nixpkgs
[2022-12-19 19:19:26] [profile] END   reload /home/kghost/workspace/nixpkgs  0ms
[2022-12-19 19:19:26] [profile] START reload /home/kghost/workspace/nixpkgs/lib
[2022-12-19 19:19:26] [profile] END   reload /home/kghost/workspace/nixpkgs/lib  0ms
[2022-12-19 19:19:26] [profile] START draw
[2022-12-19 19:19:26] [profile] END   draw  1ms
[2022-12-19 19:19:26] [profile] START git job /home/kghost/workspace/nixpkgs nil
[2022-12-19 19:19:26] [git] running job with timeout 400ms
[2022-12-19 19:19:26] [git] git --no-optional-locks status --porcelain=v1 -z --ignored=matching -u
!! .idea/
!! nixpkgs.iml
[2022-12-19 19:19:26] [git] done
[2022-12-19 19:19:26] [profile] END   git job /home/kghost/workspace/nixpkgs nil  133ms
[2022-12-19 19:19:26] [git] job success    /home/kghost/workspace/nixpkgs nil
[2022-12-19 19:19:26] [profile] START reload /home/kghost/workspace/nixpkgs
[2022-12-19 19:19:26] [profile] END   reload /home/kghost/workspace/nixpkgs  0ms
[2022-12-19 19:19:26] [profile] START reload /home/kghost/workspace/nixpkgs/lib
[2022-12-19 19:19:26] [profile] END   reload /home/kghost/workspace/nixpkgs/lib  0ms
[2022-12-19 19:19:26] [profile] START draw
[2022-12-19 19:19:26] [profile] END   draw  1ms
[2022-12-19 19:19:26] [profile] START git job /home/kghost/workspace/nixpkgs nil
[2022-12-19 19:19:26] [git] running job with timeout 400ms
[2022-12-19 19:19:26] [git] git --no-optional-locks status --porcelain=v1 -z --ignored=matching -u

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions