snacks.nvim icon indicating copy to clipboard operation
snacks.nvim copied to clipboard

perf(dashboard): speed up filtering for recent_files

Open joshuali925 opened this issue 1 week ago • 3 comments

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:

  1. add the above section config in dashboard
  2. increase oldfiles limit and populate up to the limit
  3. mkdir brand-new-directory; cd brand-new-directory; nvim
  4. the section is empty as expected, but it takes a few seconds before dashboard shows up

Related Issue(s)

Screenshots

joshuali925 avatar Feb 17 '25 20:02 joshuali925