neogit icon indicating copy to clipboard operation
neogit copied to clipboard

Bad scrolling performance in git log buffer

Open mortezadadgar opened this issue 2 years ago • 8 comments

Description

Hey, It's the first time I'm using this plugin and looks pretty promising, although noticed that scrolling in a new file containing 1K lines of change is so slow

https://github.com/NeogitOrg/neogit/assets/27911493/bc4ebe53-e138-469b-aa1c-52dfcc053faa

Neovim version

NVIM v0.9.4 Build type: Release LuaJIT 2.1.1697887905

Operating system and version

Gentoo Linux

Steps to reproduce

  1. create a file like https://0x0.st/HvUQ.txt
  2. init git repo and commit
  3. open nvim with minmal config and :Neogit
  4. open git log in neogit
  5. scroll in buffer and watch neovim struggles to scroll smoothly

Expected behavior

scroll smoothly

Actual behavior

scrolling in git log buffer is choppy and slow

Minimal config

local lazypath = vim.fn.stdpath("data") .. "/lazy/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",
		"--branch=stable",
		lazypath,
	})
end
vim.opt.rtp:prepend(lazypath)

require("lazy").setup({
	{ "NeogitOrg/neogit", config = true },
	"nvim-lua/plenary.nvim",
})

mortezadadgar avatar Nov 18 '23 18:11 mortezadadgar

Yeah. There's some gnarly o(n) logic here. I've been meaning to do something about it, but haven't found the time yet.

CKolkey avatar Nov 20 '23 19:11 CKolkey

Well, it just so happens that nvim 0.10 added an API that will let us do native folding instead of the custom stuff we do now! https://github.com/NeogitOrg/neogit/pull/959

So, this won't look nice for the current stable release, but it's a HUGE performance win.

CKolkey avatar Nov 22 '23 10:11 CKolkey

Thanks for fixing it can't wait for it to be merged!

mortezadadgar avatar Nov 22 '23 11:11 mortezadadgar

Same, this has been bugging me for ages.

CKolkey avatar Nov 22 '23 11:11 CKolkey

@CKolkey the slowness is not fixed I believe it has gone even worse you can reproduce it with the file that i have attached in issue

mortezadadgar avatar Dec 03 '23 07:12 mortezadadgar

Fix won't be on master until nvim 0.10. For now, you can test it out on the nightly branch (assuming you're on nvim nightly)

I haven't finished punching up the commit view, so can't make any claims about that

CKolkey avatar Dec 03 '23 08:12 CKolkey

oh sorry I thought that's merged into master branch

mortezadadgar avatar Dec 03 '23 09:12 mortezadadgar

Ahh, yeah, no, it uses the new native folds, which requires api's that are only on nightly. Eta... march? Not my call :)

CKolkey avatar Dec 03 '23 12:12 CKolkey