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

Takes 0.1s to load for 41 history items #35

Open
xzbdmw opened this issue Apr 28, 2024 · 4 comments
Open

Takes 0.1s to load for 41 history items #35

xzbdmw opened this issue Apr 28, 2024 · 4 comments

Comments

@xzbdmw
Copy link

xzbdmw commented Apr 28, 2024

image
remove that function speed back

@coffebar
Copy link
Owner

Have no idea how to reproduce

@xzbdmw
Copy link
Author

xzbdmw commented Apr 28, 2024

This is my file structure that takes 100ms

local projects = {
  "~/Project/lua/lua/fzf-lua",
  "~/Project/lua/fork/arrow.nvim",
  "~/Project/lua/color/nvim-cmp",
  "~/Project/lua/origin/nvim-cmp",
  "~/Documents/xzbdmw的副本",
  "~/Project/rust/2022-06-15-blogpost",
  "~/Project/rust/addr_test",
  "~/Project/rust/advent-of-code",
  "~/Project/rust/aoc-2018",
  "~/Project/rust/async-chat",
  "~/Project/rust/async_await",
  "~/Project/rust/bicask",
  "~/Project/rust/black-hat-rust",
  "~/Project/rust/blog-rs",
  "~/Project/rust/blog_os",
  "~/Project/rust/cell",
  "~/Project/rust/closure_study",
  "~/Project/rust/codecrafters-bittorrent-rust",
  "~/Project/rust/command-line-rust",
  "~/Project/rust/csv",
  "~/Project/rust/csv 2",
  "~/Project/rust/enum_learning",
  "~/Project/rust/eventful",
  "~/Project/rust/executor",
  "~/Project/rust/flurry",
  "~/Project/rust/git-toy",
  "~/Project/rust/gossip",
  "~/Project/rust/Hands-On-Concurrency-with-Rust",
  "~/Project/rust/inferno",
  "~/Project/rust/io_study",
  "~/Project/rust/iterators",
  "~/Project/rust/iterators_study",
  "~/Project/rust/jlox-rs",
  "~/Project/rust/lifetimekata",
  "~/Project/rust/lists",
  "~/Project/rust/lox",
  "~/Project/rust/lox-bytecode",
  "~/Project/rust/loxcraft",
  "~/Project/rust/markdown-oxide",
  "~/Project/rust/mini-redis",
  "~/Project/rust/myneovide",
  "~/Project/rust/neovide",
  "~/Project/rust/news-letter",
  "~/Project/rust/operation_overload",
  "~/Project/rust/panama",
  "~/Project/rust/pdf_writer",
  "~/Project/rust/pyt",
  "~/Project/rust/rcore-ch2",
  "~/Project/rust/rcore-ch3",
  "~/Project/rust/rcore-ch4",
  "~/Project/rust/rcore-ch5",
  "~/Project/rust/rCore-Tutorial-v3",
  "~/Project/rust/rust-magic-function-params",
  "~/Project/rust/rust-skia-variable-fonts-bug",
  "~/Project/rust/rusty_llama",
  "~/Project/rust/rust_atomics",
  "~/Project/rust/rust_leetcode",
  "~/Project/rust/serde-whatnow",
  "~/Project/rust/spwan-blocking",
  "~/Project/rust/stroke",
  "~/Project/rust/str_split",
  "~/Project/rust/swash_demo",
  "~/Project/rust/tcp",
  "~/Project/rust/trait_learning",
  "~/Project/rust/trust",
  "~/Project/rust/ttt",
  "~/Project/rust/utility_trait",
  "~/Project/rust/wechat-spider",
  "~/Project/rust/what-is-pin",
  "~/Project/rust/what-is-tower",
  "~/Project/rust/wordle-solver",
  "~/Project/rust/wx_spider_xzb",
  "~/Project/rust/xdiff",
  "~/Project/rust/xzbdmw",
  "~/Project/rust/zed",
  "~/Project/rust/zero-to-production",
  "~/Project/vim/practical-vim",
  "~/Project/lua/arrow.nvim",
  "~/Project/lua/autoload",
  "~/Project/lua/bookmarktest",
  "~/Project/lua/color",
  "~/Project/lua/context",
  "~/Project/lua/context1",
  "~/Project/lua/context2",
  "~/Project/lua/doc",
  "~/Project/lua/fork",
  "~/Project/lua/glance.nvim",
  "~/Project/lua/lua",
  "~/Project/lua/nvim-cmp",
  "~/Project/lua/nvim-treesitter-context",
  "~/Project/lua/origin",
  "~/Project/lua/plugin",
  "~/Project/lua/portal.nvim",
  "~/Project/lua/scripts",
  "~/Project/lua/tests",
  "~/Project/lua/tts",
  "~/Project/Typescript/my-vue-project",
  "~/Project/Typescript/type-challenges",
  "~/Project/Go/6.824_last_year",
  "~/Project/Go/6.824_myself_not_finish",
  "~/Project/Go/6.824_others",
  "~/Project/Go/bicask",
  "~/Project/Go/concurrency-in-go",
  "~/Project/Go/Effective-Concurrency-in-Go",
  "~/Project/Go/github",
  "~/Project/Go/gopl.io",
  "~/Project/Go/GoProgrammingFromBeginnerToMaster",
  "~/Project/Go/leetcode",
  "~/Project/Go/proglog",
  "~/Project/C/clox",
  "~/Project/C/craftinginterpreters",
  "~/Project/C/Hands-On-Network-Programming-with-C",
  "~/Project/C/Hands-on-System-Programming-with-Linux",
  "~/Project/C/linux",
  "~/Project/C/Linux-Kernel-Programming",
  "~/Project/C/neovim",
  "~/Project/C/os_code",
  "~/Project/C/pvtrace_test",
  "~/Project/C/redis_book_code",
  "~/Project/C/text_editor",
  "~/Project/C/tlpi-dist",
  "~/Project/C/tlpi_wrapper",
  "~/.local/share/nvim/lazy/aerial.nvim",
  "~/.local/share/nvim/lazy/arrow.nvim",
  "~/.local/share/nvim/lazy/bigfile.nvim",
  "~/.local/share/nvim/lazy/blame.nvim",
  "~/.local/share/nvim/lazy/bufferline.nvim",
  "~/.local/share/nvim/lazy/catppuccin",
  "~/.local/share/nvim/lazy/cmp-buffer",
  "~/.local/share/nvim/lazy/cmp-cmdline",
  "~/.local/share/nvim/lazy/cmp-nvim-lsp",
  "~/.local/share/nvim/lazy/cmp-path",
  "~/.local/share/nvim/lazy/cmp_luasnip",
  "~/.local/share/nvim/lazy/coc.nvim",
  "~/.local/share/nvim/lazy/code_runner.nvim",
  "~/.local/share/nvim/lazy/Comment.nvim",
  "~/.local/share/nvim/lazy/conform.nvim",
  "~/.local/share/nvim/lazy/copilot-cmp",
  "~/.local/share/nvim/lazy/copilot.lua",
  "~/.local/share/nvim/lazy/dashboard-nvim",
  "~/.local/share/nvim/lazy/diffview.nvim",
  "~/.local/share/nvim/lazy/dressing.nvim",
  "~/.local/share/nvim/lazy/dropbar.nvim",
  "~/.local/share/nvim/lazy/flash.nvim",
  "~/.local/share/nvim/lazy/flit.nvim",
  "~/.local/share/nvim/lazy/friendly-snippets",
  "~/.local/share/nvim/lazy/fzf-lua",
  "~/.local/share/nvim/lazy/gitsigns.nvim",
  "~/.local/share/nvim/lazy/glance.nvim",
  "~/.local/share/nvim/lazy/guess-indent.nvim",
  "~/.local/share/nvim/lazy/highlight-undo.nvim",
  "~/.local/share/nvim/lazy/hlchunk.nvim",
  "~/.local/share/nvim/lazy/hydra.nvim",
  "~/.local/share/nvim/lazy/inc-rename.nvim",
  "~/.local/share/nvim/lazy/incline.nvim",
  "~/.local/share/nvim/lazy/indent-blankline.nvim",
  "~/.local/share/nvim/lazy/lazy.nvim",
  "~/.local/share/nvim/lazy/LazyVim",
  "~/.local/share/nvim/lazy/leap.nvim",
  "~/.local/share/nvim/lazy/legendary.nvim",
  "~/.local/share/nvim/lazy/lspkind.nvim",
  "~/.local/share/nvim/lazy/lspsaga.nvim",
  "~/.local/share/nvim/lazy/lualine.nvim",
  "~/.local/share/nvim/lazy/LuaSnip",
  "~/.local/share/nvim/lazy/lush.nvim",
  "~/.local/share/nvim/lazy/mason-lspconfig.nvim",
  "~/.local/share/nvim/lazy/mason.nvim",
  "~/.local/share/nvim/lazy/mini.ai",
  "~/.local/share/nvim/lazy/mini.bufremove",
  "~/.local/share/nvim/lazy/mini.comment",
  "~/.local/share/nvim/lazy/mini.completion",
  "~/.local/share/nvim/lazy/mini.diff",
  "~/.local/share/nvim/lazy/mini.indentscope",
  "~/.local/share/nvim/lazy/mini.jump",
  "~/.local/share/nvim/lazy/mini.map",
  "~/.local/share/nvim/lazy/mini.nvim",
  "~/.local/share/nvim/lazy/mini.pairs",
  "~/.local/share/nvim/lazy/mini.surround",
  "~/.local/share/nvim/lazy/multicursors.nvim",
  "~/.local/share/nvim/lazy/neo-tree.nvim",
  "~/.local/share/nvim/lazy/neoconf.nvim",
  "~/.local/share/nvim/lazy/neodev.nvim",
  "~/.local/share/nvim/lazy/neovim-project",
  "~/.local/share/nvim/lazy/neovim-session-manager",
  "~/.local/share/nvim/lazy/nightfox.nvim",
  "~/.local/share/nvim/lazy/no-neck-pain.nvim",
  "~/.local/share/nvim/lazy/noice.nvim",
  "~/.local/share/nvim/lazy/nui-components.nvim",
  "~/.local/share/nvim/lazy/nui.nvim",
  "~/.local/share/nvim/lazy/nvim-autopairs",
  "~/.local/share/nvim/lazy/nvim-bufdel",
  "~/.local/share/nvim/lazy/nvim-cmp",
  "~/.local/share/nvim/lazy/nvim-colorizer.lua",
  "~/.local/share/nvim/lazy/nvim-fundo",
  "~/.local/share/nvim/lazy/nvim-lint",
  "~/.local/share/nvim/lazy/nvim-lspconfig",
  "~/.local/share/nvim/lazy/nvim-notify",
  "~/.local/share/nvim/lazy/nvim-spectre",
  "~/.local/share/nvim/lazy/nvim-spider",
  "~/.local/share/nvim/lazy/nvim-tree.lua",
  "~/.local/share/nvim/lazy/nvim-treesitter",
  "~/.local/share/nvim/lazy/nvim-treesitter-context",
  "~/.local/share/nvim/lazy/nvim-treesitter-textobjects",
  "~/.local/share/nvim/lazy/nvim-ts-autotag",
  "~/.local/share/nvim/lazy/nvim-ts-context-commentstring",
  "~/.local/share/nvim/lazy/nvim-ufo",
  "~/.local/share/nvim/lazy/nvim-web-devicons",
  "~/.local/share/nvim/lazy/oil.nvim",
  "~/.local/share/nvim/lazy/persistence.nvim",
  "~/.local/share/nvim/lazy/plenary.nvim",
  "~/.local/share/nvim/lazy/profile.nvim",
  "~/.local/share/nvim/lazy/project.nvim",
  "~/.local/share/nvim/lazy/promise-async",
  "~/.local/share/nvim/lazy/rainbow-delimiters.nvim",
  "~/.local/share/nvim/lazy/refactoring.nvim",
  "~/.local/share/nvim/lazy/rustaceanvim",
  "~/.local/share/nvim/lazy/satellite.nvim",
  "~/.local/share/nvim/lazy/scrollEOF.nvim",
  "~/.local/share/nvim/lazy/sentiment.nvim",
  "~/.local/share/nvim/lazy/smart-open.nvim",
  "~/.local/share/nvim/lazy/smart-splits.nvim",
  "~/.local/share/nvim/lazy/sqlite.lua",
  "~/.local/share/nvim/lazy/telescope-file-browser.nvim",
  "~/.local/share/nvim/lazy/telescope-fzf-native.nvim",
  "~/.local/share/nvim/lazy/telescope-undo.nvim",
  "~/.local/share/nvim/lazy/telescope-zf-native.nvim",
  "~/.local/share/nvim/lazy/telescope.nvim",
  "~/.local/share/nvim/lazy/todo-comments.nvim",
  "~/.local/share/nvim/lazy/toggleterm.nvim",
  "~/.local/share/nvim/lazy/tokyonight.nvim",
  "~/.local/share/nvim/lazy/trouble.nvim",
  "~/.local/share/nvim/lazy/undotree",
  "~/.local/share/nvim/lazy/venv-selector.nvim",
  "~/.local/share/nvim/lazy/vim-fugitive",
  "~/.local/share/nvim/lazy/vim-illuminate",
  "~/.local/share/nvim/lazy/vim-sneak",
  "~/.local/share/nvim/lazy/vim-startuptime",
  "~/.local/share/nvim/lazy/vim-visual-multi",
  "~/.local/share/nvim/lazy/which-key.nvim",
  "~/.local/share/nvim/lazy/yanky.nvim",
  "~/Project/java/effective-java-3e-source-code",
  "~/Project/java/effectivejava",
  "~/Project/java/GenerateAst",
  "~/Project/java/ggg",
  "~/Project/java/intellij-indent-rainbow",
  "~/Project/java/libSeat",
  "~/Project/java/libSeat的副本",
  "~/Project/java/Lox",
  "~/Project/java/scrm",
  "~/Project/java/suanfa",
  "~/Project/java/test",
  "~/Project/Typescript/my-vue-project",
  "~/Project/Typescript/type-challenges",
  "~/Project/Python/AudioClassification-Pytorch",
  "~/Project/Python/clrs",
  "~/Project/Python/example-code-2e",
  "~/Project/Python/handson-ml3",
  "~/Project/Python/nn-from-scratch",
  "~/Project/Python/pythonProject",
  "~/Project/Python/string_sum",
  "~/Project/Python/wechat_articles_spider",
  "~/Documents/xzbdmw的副本/000 Inbox",
  "~/Documents/xzbdmw的副本/001 Linux",
  "~/Documents/xzbdmw的副本/002 Algorithm",
  "~/Documents/xzbdmw的副本/003 Attachment",
  "~/Documents/xzbdmw的副本/004 Machine learning",
  "~/Documents/xzbdmw的副本/005 Distribution System",
  "~/Documents/xzbdmw的副本/006 DataBase",
  "~/Documents/xzbdmw的副本/007 Swift",
  "~/Documents/xzbdmw的副本/008 Rust",
  "~/.config/clash",
  "~/.config/coc",
  "~/.config/configstore",
  "~/.config/fish",
  "~/.config/flutter",
  "~/.config/fontforge",
  "~/.config/ghc",
  "~/.config/github-copilot",
  "~/.config/GNS3",
  "~/.config/helix",
  "~/.config/htop",
  "~/.config/iterm2",
  "~/.config/jgit",
  "~/.config/karabiner",
  "~/.config/kitty",
  "~/.config/lvim",
  "~/.config/neovide",
  "~/.config/nnn",
  "~/.config/node_modules",
  "~/.config/nvim",
  "~/.config/nvim-empty",
  "~/.config/nvim.back",
  "~/.config/nvim.backk",
  "~/.config/nvim.bak",
  "~/.config/nvimff",
  "~/.config/nvimlazy",
  "~/.config/nvimlazy2",
  "~/.config/nvimtest",
  "~/.config/nvim_focus",
  "~/.config/nvim_new",
  "~/.config/nvim_rust",
  "~/.config/omf",
  "~/.config/pgcli",
  "~/.config/raycast",
  "~/.config/rustfmt",
  "~/.config/wezterm",
  "~/.config/wireshark",
  "~/.config/zed",
}
local dirs = {
  "~/.local/share/nvim/lazy/oil.nvim",
  "~/.local/share/nvim/lazy/noice.nvim",
  "~/.local/share/nvim/lazy/neovim-session-manager",
  "~/Project/lua/fork/arrow.nvim",
  "~/.local/share/nvim/lazy/gitsigns.nvim",
  "~/.local/share/nvim/lazy/nvim-tree.lua",
  "~/Project/rust/neovide",
  "~/Project/rust/myneovide",
  "~/Project/rust/zed",
  "~/.local/share/nvim/lazy/nvim-treesitter",
  "~/Project/C/clox",
  "~/Project/C/neovim",
  "~/.local/share/nvim/lazy/LuaSnip",
  "~/.local/share/nvim/lazy/mini.completion",
  "~/Project/rust/bicask",
  "~/.local/share/nvim/lazy/cmp-nvim-lsp",
  "~/Project/lua/nvim-cmp",
  "~/Project/lua/origin/nvim-cmp",
  "~/Project/lua/color/nvim-cmp",
  "~/.local/share/nvim/lazy/incline.nvim",
  "~/.config/nvimlazy",
  "~/.local/share/nvim/lazy/lazy.nvim",
  "~/.local/share/nvim/lazy/LazyVim",
  "~/.local/share/nvim/lazy/mini.indentscope",
  "~/Project/lua/nvim-treesitter-context",
  "~/.local/share/nvim/lazy/nvim-cmp",
  "~/.local/share/nvim/lazy/telescope-zf-native.nvim",
  "~/.local/share/nvim/lazy/telescope-fzf-native.nvim",
  "~/.local/share/nvim/lazy/smart-open.nvim",
  "~/.local/share/nvim/lazy/hlchunk.nvim",
  "~/Project/lua/arrow.nvim",
  "~/.local/share/nvim/lazy/satellite.nvim",
  "~/.local/share/nvim/lazy/arrow.nvim",
  "~/Project/lua/glance.nvim",
  "~/Project/Go/leetcode",
  "~/.config/nvim_rust",
  "~/Project/rust/rust_leetcode",
  "~/.local/share/nvim/lazy/vim-illuminate",
  "~/.local/share/nvim/lazy/telescope.nvim",
  "~/.config/nvim",
  "~/.local/share/nvim/lazy/neovim-project",
}

vim.keymap.set("n", "<leader>sj", function()
  local start_time = vim.loop.hrtime()
  for i, dir in ipairs(dirs) do
    for _, path in ipairs(projects) do
      if M.resolve(path) == M.resolve(dir) then
        dirs[i] = path
        break
      end
    end
  end
  local duration = 0.000001 * (vim.loop.hrtime() - start_time)
  -- __AUTO_GENERATED_PRINT_VAR_START__
  print([==[function duration:]==], vim.inspect(duration)) -- __AUTO_GENERATED_PRINT_VAR_END__
end)

To reproduce it you can just set projects to lazy's folder something like

    opts = {
        filetype_autocmd_timeout = 0,
        last_session_on_startup = true,
        projects = { -- define project roots
            "/Users/xzb/.local/share/nvim/lazy/*",
        },

and add several plugin to history file
My test is I have 100 plugin folder and 40 history file, it takes 60-80ms.

@xzbdmw
Copy link
Author

xzbdmw commented Apr 28, 2024

vimscript is crazy here. But I don't find lua alternative

@coffebar
Copy link
Owner

It was 40ms with my projects, a have added "~/.local/share/nvim/lazy/*", and it is 20ms more, anyway I don't see any delay visually. I have added a little optimization, now it's around 25ms for me

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