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

Slow startup with lualine integration #28

Open
alexmozaidze opened this issue Jan 16, 2024 · 5 comments
Open

Slow startup with lualine integration #28

alexmozaidze opened this issue Jan 16, 2024 · 5 comments

Comments

@alexmozaidze
Copy link
Contributor

I've noticed in the Lazy profiler that Modicator takes a long time to load, somewhere around 600-900ms. When I remove Modicator, Neovim opens almost instantly. I am unsure of what's causing such a slowdown, and glancing over the codebase, couldn't think of any probable cause.

Note

In order to view the actual time it takes for the plugin to load, lazy-load it upon UIEnter.

Screenshot_2024-01-16-13-24-43-136_com termux

@mawkler
Copy link
Owner

mawkler commented Jan 16, 2024

@alexmozaidze Hmmm, that's very odd. I can't think of an obvious reason for this either.

Try creating a minimal config that includes just Modicator (and perhaps also lualine and your colorscheme). Does that give you the same behaviour?

I personally lazy load it on ModeChanged. Do you get the same one-second load time if you do that (and trigger it by changing mode)?

@alexmozaidze
Copy link
Contributor Author

alexmozaidze commented Jan 16, 2024

I did some experimenting and found out that lualine integration was the root cause of slow startup.

Toggle lualine integration on/off to see the difference in startup time.

Here's a minimal vimrc with Lazy for profiling:

Minimal config
-- Bootstrapping Lazy package manager
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)

-- Setting up plugins
require "lazy".setup {
   {
      "nvim-lualine/lualine.nvim",
      event = "UIEnter",
      init = function()
         vim.opt.showmode = false
      end,
      opts = {},
   },
   {
      "mawkler/modicator.nvim",
      event = "UIEnter",
      init = function()
         vim.o.cursorline = true
         vim.o.number = true
         vim.o.termguicolors = true
      end,
      opts = {
         integration = {
            lualine = {
               -- Toggle for slow startup
               enabled = false
            }
         }
      }
   },
   {
      "alexmozaidze/palenight.nvim",
      priority = 1000,
   },
}

-- Load the sexy
vim.cmd.colorscheme "palenight"

@alexmozaidze alexmozaidze changed the title Slow startup Slow startup with lualine integration Jan 16, 2024
@mawkler
Copy link
Owner

mawkler commented Jan 19, 2024

@alexmozaidze I get 60-70 ms startup for Modicator with Lualine integration enabled, and ~10 ms with it disabled. What version of Neovim are you using? I'm currently testing on nightly v0.10.0-dev-1962+gc26dc1f77.

@alexmozaidze
Copy link
Contributor Author

alexmozaidze commented Jan 29, 2024

NVIM v0.9.5
Build type: Release
LuaJIT 2.1.0-beta3

But it happens on Nightly too, iirc.
I should also mention that all my machines are quite weak, so there is a chance that the slowness is there for you too, but the CPU speed mitigates it to unnoticeable.

Sorry for late response.

@mawkler
Copy link
Owner

mawkler commented Feb 10, 2024

I see! Yeah I'm not sure what could be causing this for you. I'll leave this open and see if anyone else has a similar issue that can help us figure out what's going on.

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