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

Slow performance when "+[p #236

Open
ColinKennedy opened this issue Apr 10, 2024 · 2 comments
Open

Slow performance when "+[p #236

ColinKennedy opened this issue Apr 10, 2024 · 2 comments

Comments

@ColinKennedy
Copy link

When I use [p, it is fast. But if I get from the "+ register, [p and ]p are slow.

OS: Windows 10
Terminal: Wezterm
Shell: WSL (Ubuntu 20.02)
Neovim version:

:version
NVIM v0.10.0-dev-2791+g99b3a068d
Build type: RelWithDebInfo
LuaJIT 2.1.1710088188
nvim -u reproduction.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", "https://github.com/folke/lazy.nvim.git", lazypath, })
end
vim.opt.runtimepath:prepend(lazypath)

-- install plugins
local plugins = {
  -- Adds pair mappings (like ]l [l) to Vim
  {
      "tpope/vim-unimpaired",
      version = "2.*",
  },
}
require("lazy").setup(plugins, {
  root = root .. "/plugins",
})


vim.cmd[[set laststatus=3]]
  • Open Neovim
  • Make a line with any text
  • "+yy to copy it
  • Paste it with "+[p

If you copy it to a different register and paste, it's normal speed (fast)

I did a profile file * | profile func * and 0.5 seconds are devoted to this chunk of code

FUNCTION  <SNR>69_putline()
    Defined: ~/repositories/personal/.config/nvim/bundle/vim-unimpaired/plugin/unimpaired.vim:408
Called 1 time
Total time:   0.568220
 Self time:   0.567142

count  total (s)   self (s)
    1              0.376446   let [body, type] = [getreg(v:register), getregtype(v:register)]
    1              0.000007   if type ==# 'V'
    1   0.191621   0.190604     exe 'normal! "'.v:register.a:how
                              else
                                call setreg(v:register, body, 'l')
                                exe 'normal! "'.v:register.a:how
                                call setreg(v:register, body, type)
    1              0.000002   endif
    1   0.000111   0.000050   silent! call repeat#set("\<Plug>(unimpaired-put-".a:map.")")
@justinmk
Copy link
Contributor

Nvim clipboard performance (the "+ register) depends on how you have defined g:clipboard. It's common for that to involve powershell in WSL.

@ColinKennedy
Copy link
Author

I'm using Wezterm + cmd, should I switch to a different terminal / shell?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants