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

How to troubleshoot extremely slow startup? #219

Closed
dfalling opened this issue Jul 5, 2024 · 8 comments
Closed

How to troubleshoot extremely slow startup? #219

dfalling opened this issue Jul 5, 2024 · 8 comments

Comments

@dfalling
Copy link

dfalling commented Jul 5, 2024

I tracked down my very slow nvim launch time to requiring the elixir package:

vim file --startuptime log

...
066.620  000.361: inits 3
069.277  002.657: reading ShaDa
071.248  000.261  000.261: require('vim.iter')
072.756  000.496  000.496: require('plenary.bit')
072.954  000.197  000.197: require('plenary.functional')
072.975  001.452  000.760: require('plenary.path')
073.688  000.133  000.133: require('plenary.strings')
073.690  000.383  000.250: require('plenary.window.border')
073.892  000.202  000.202: require('plenary.window')
074.257  000.364  000.364: require('plenary.popup.utils')
074.260  001.284  000.335: require('plenary.popup')
074.660  000.399  000.399: require('elixir.elixirls.version')
075.656  000.233  000.233: require('plenary.compat')
075.662  000.756  000.524: require('plenary.job')
076.062  000.399  000.399: require('elixir.utils')
076.063  001.402  000.246: require('elixir.elixirls.download')
076.474  000.409  000.409: require('elixir.elixirls.compile')
077.734  006.485  001.538: require('elixir.elixirls')
078.096  000.360  000.360: require('elixir.credo')
078.312  000.215  000.215: require('elixir.nextls')
079.150  000.178  000.178: require('elixir.mix.git')
079.151  000.363  000.185: require('elixir.mix.exs')
079.152  000.649  000.286: require('elixir.mix.wrapper')
079.154  000.840  000.192: require('elixir.mix')
079.380  000.225  000.225: require('elixir.projectionist')
079.387  009.617  001.231: require('elixir')
2630.997  001.809  001.809: require('vim.filetype')

I'm importing it via:

  {
    "elixir-tools/elixir-tools.nvim",
    version = "*",
    event = { "BufReadPre", "BufNewFile" },
    config = function()
      local elixir = require("elixir")
      local elixirls = require("elixir.elixirls")

      elixir.setup {
        nextls = {enable = true},
        credo = {},
        elixirls = {enable = false,}
      }
    end,
    dependencies = {
      "nvim-lua/plenary.nvim",
    },
  },

Any tips on further tracking down what I've screwed up to make it load so slowly?

Thanks!

@dfalling dfalling changed the title How to troubleshoot extremely show startup? How to troubleshoot extremely slow startup? Jul 5, 2024
@mhanberg
Copy link
Collaborator

mhanberg commented Jul 5, 2024

can you open a file like nvim lib/some_file.ex and then see what :Lazy profile says for elixir-tools.nvim ?

For me it says 0.91ms.

Also, try explicitly disabled credo language server

@dfalling
Copy link
Author

dfalling commented Jul 7, 2024

Strangely it's been very slow on non-Elixir files as well (eg opening my .gitconfig.) I think it may be network-related, as I have good WiFi for the first time in weeks and it's snappy again:

elixir-tools.nvim 282.19ms

Disabling credo got it down:
elixir-tools.nvim 5.21ms

I'll profile it again when it's slow again.

@dfalling
Copy link
Author

dfalling commented Jul 8, 2024

I have mediocre wifi now, and the startup time is ramping back up:

    ●  BufReadPre 884ms
      ➜  elixir-tools.nvim 883.79ms

@dfalling
Copy link
Author

    ●  BufReadPre 1319.58ms
      ➜  elixir-tools.nvim 1319.54ms

So it's definitely very network dependent. All my other packages don't seem to be affected the same way. Is there something I can do to disable this network dependency?

@mhanberg
Copy link
Collaborator

Is credo still disabled? there shouldn't be anything else that hits the network

@dfalling
Copy link
Author

Ah good call, I had re-enabled it. Is there any way to keep Credo from hitting the network? Disabling it definitely resolves the lag though I'd love to be able to use it.

@mhanberg
Copy link
Collaborator

If you are using Next LS, then it already comes with credo integration, so you don't need to use it.

@dfalling
Copy link
Author

Perfect, thank you!

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