The current implementation of Session:replace_sources (which, as I understand, is ran every time you switch between files in :DiffBanditGit, among other things) always calls this function:
|
local hunks, view = build_view_for_sources(sources, self.config) |
This means that, on every switch between files, even when there's been no change to the source files, the method forces:
- hunks to be re-computed
|
local hunks, err = diff_mod.compute_hunks(sources.left.text, sources.right.text, config.diff) |
- the view builder to re-build the view
|
local view = view_builder.build(sources.left.lines, sources.right.lines, hunks, config) |
I suspect this might be causing a significant drop in performance (on my machine it literally stalls for a few seconds). A simple cache for the built views might be enough to save on computing power without sacrificing too much memory. That way views would only have to be re-built when there's been a change to the viewed file, or when re-entering the DiffBandit screen.
PS I really like this plugin, especially the visuals! The performance is really my only issue with it, and if that could be fixed, this would be the perfect plugin for viewing diffs and merge conflicts :)
The current implementation of
Session:replace_sources(which, as I understand, is ran every time you switch between files in:DiffBanditGit, among other things) always calls this function:diffbandit.nvim/lua/diffbandit/session/init.lua
Line 1063 in c5c251d
This means that, on every switch between files, even when there's been no change to the source files, the method forces:
diffbandit.nvim/lua/diffbandit/session/init.lua
Line 52 in c5c251d
diffbandit.nvim/lua/diffbandit/session/init.lua
Line 56 in c5c251d
I suspect this might be causing a significant drop in performance (on my machine it literally stalls for a few seconds). A simple cache for the built views might be enough to save on computing power without sacrificing too much memory. That way views would only have to be re-built when there's been a change to the viewed file, or when re-entering the DiffBandit screen.
PS I really like this plugin, especially the visuals! The performance is really my only issue with it, and if that could be fixed, this would be the perfect plugin for viewing diffs and merge conflicts :)