snacks.nvim
snacks.nvim copied to clipboard
perf(dashboard): speed up filtering for recent_files
Description
I have 5000 oldfiles, every time i go to a new directory and open nvim, the dashboard recent_files (with cwd=true
) computation takes 4-5 seconds to go through all oldfiles before deciding nothing should show up
sections = {
{ icon = " ", title = "Recent files (current directory)", section = "recent_files", cwd = true },
}
It appears to be the vim.v.oldfiles[i]
indexing. I didn't look much into it but it opens much faster looping with ipairs.
Repro:
- add the above section config in dashboard
- increase oldfiles limit and populate up to the limit
-
mkdir brand-new-directory; cd brand-new-directory; nvim
- the section is empty as expected, but it takes a few seconds before dashboard shows up