mawkler / modicator.nvim

Cursor line number mode indicator plugin for Neovim
MIT License
298 stars 6 forks source link

Slow startup with lualine integration #28

Open alexmozaidze opened 6 months ago

alexmozaidze commented 6 months ago

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 commented 6 months ago

@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 commented 6 months ago

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 ```lua -- 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" ```
mawkler commented 6 months ago

@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 commented 5 months ago
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 commented 5 months ago

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.