Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

bug: load_buffers = true is slow #39

Closed
phcerdan opened this issue Jan 20, 2025 · 3 comments
Closed

bug: load_buffers = true is slow #39

phcerdan opened this issue Jan 20, 2025 · 3 comments
Labels
bug Something isn't working

Comments

@phcerdan
Copy link

phcerdan commented Jan 20, 2025

Neovim version (nvim -v)

0.10.3

Operating system/version

Linux

Describe the bug

It is suggested in the help, but the default highlight = { load_buffers = true } makes impossible to grep into quickfix.

I wonder if it would be better to turn it off by default?

My test, grepping a word with 300 matches from multiple files, with load_buffers = true, it takes seconds, with the option false is instant.

What is the severity of this bug?

minor (annoyance)

Steps To Reproduce

  {
    "stevearc/quicker.nvim", -- This allows to substitute directly from qlist, instead of :cdo
    config = function()
      require("quicker").setup({
        highlight = {
          load_buffers = false, -- the default is true and it is incredibly slow
        }
      })
    end,
  },

Expected Behavior

Maybe this is expected, I just "complain" about the default value. Maybe it should be off.

Minimal example file

No response

Minimal init.lua

-- DO NOT change the paths and don't remove the colorscheme
local root = vim.fn.fnamemodify("./.repro", ":p")

-- set stdpaths to use .repro
for _, name in ipairs({ "config", "data", "state", "cache" }) do
  vim.env[("XDG_%s_HOME"):format(name:upper())] = root .. "/" .. name
end

-- bootstrap lazy
local lazypath = root .. "/plugins/lazy.nvim"
if not vim.loop.fs_stat(lazypath) then
  vim.fn.system({
    "git",
    "clone",
    "--filter=blob:none",
    "--single-branch",
    "https://github.com/folke/lazy.nvim.git",
    lazypath,
  })
end
vim.opt.runtimepath:prepend(lazypath)

-- install plugins
local plugins = {
  "folke/tokyonight.nvim",
  {
    "stevearc/quicker.nvim",
    config = function()
      require("quicker").setup({
        -- add your config here
      })
    end,
  },
  -- add any other plugins here
}
require("lazy").setup(plugins, {
  root = root .. "/plugins",
})

vim.cmd.colorscheme("tokyonight")
-- add anything else here

Additional context

No response

@phcerdan phcerdan added the bug Something isn't working label Jan 20, 2025
@stevearc
Copy link
Owner

The reason that it is the default is because it produces better highlighting and, while it takes longer than not loading the buffers, doesn't block your UI thread. It may take some time for all lines to get highlighted, but you should still be able to use Neovim more-or-less as usual while that is ongoing. If that is not your experience, let me know and we'll try to resolve that. I agree that if the default settings should not cause Neovim to freeze, but it's not clear from this report if that is happening.

@stevearc stevearc added the question Further information is requested label Jan 20, 2025
@phcerdan
Copy link
Author

With load_buffer = true, blocking interface.

quicker_load_buffer_true_slow.mp4

versus load_buffer = false:

quicker_load_buffer_false_fast.mp4

I have no idea but maybe it's because it's opening big files. In any case, you can see that's indeed blocking the interface.
Hope it helps!

@github-actions github-actions bot removed the question Further information is requested label Jan 21, 2025
@stevearc
Copy link
Owner

Oh wow...that much lag for only ~300 results? My best guess is that you have one or two massive files that cause 10+ seconds of lag on load. I have it set to only load buffers in ~50ms chunks, but that doesn't help if loading one buffer blows out that budget. I think...this is a good enough reason to change the defaults.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

2 participants