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鈥檒l occasionally send you account related emails.

Already on GitHub? Sign in to your account

perf: set appropiate/missing lazy loading events #856

Merged
merged 1 commit into from
Apr 10, 2024

Conversation

manuuurino
Copy link
Contributor

馃搼 Description

Noticed some lazy loading improvements from my personal config. These were the one i am using, sorry but i cannot check all plugins, i hope i can improve the startup/running performance a tiny bit further.

Copy link

github-actions bot commented Apr 9, 2024

Review Checklist

Does this PR follow the [Contribution Guidelines](development guidelines)? Following is a partial checklist:

Proper conventional commit scoping:

  • If you are adding a new plugin, the scope would be the name of the category it is being added into. ex. feat(utility): added noice.nvim plugin

  • If you are modifying a pre-existing plugin or pack, the scope would be the name of the plugin folder. ex. fix(noice-nvim): fix LSP handler error

  • Pull request title has the appropriate conventional commit type and scope where the scope is the name of the pre-existing directory in the project as described above

  • README is properly formatted and uses fenced in links with <url> unless they are inside a [title](url)

  • Proper usage of opts table rather than setting things up with the config function.

@Uzaaft
Copy link
Member

Uzaaft commented Apr 9, 2024

@mehalter

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

will it not get loaded when using the mappings?

Copy link
Member

@mehalter mehalter left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

A few of these need to be reverted because they are significantly less performant. Other than that, thanks for the recommendations!

EDIT: realized lazy = true is no longer default, so what most of these actually just need is lazy = true since they are all lazy loaded based on module.

@@ -1,5 +1,6 @@
return {
"Pocco81/true-zen.nvim",
event = "VeryLazy",
Copy link
Member

@mehalter mehalter Apr 9, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
event = "VeryLazy",
lazy = true,

This should not be lazy loaded on event. It is lazy loaded on module and keybinding. We should make it lazy = true.

@@ -1,4 +1,4 @@
return {
"matze/vim-move",
event = "BufEnter",
event = "User AstroFile",
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
event = "User AstroFile",
event = { "User AstroFile", "InsertEnter" },

This lets it work on new files as well

@@ -1,6 +1,7 @@
return {
{
"lvimuser/lsp-inlayhints.nvim",
event = "User AstroLspSetup",
Copy link
Member

@mehalter mehalter Apr 9, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
event = "User AstroLspSetup",
lazy = true,

This lazy loading is handled by the autocmd and should not be loaded on event. This is less performant. It should just be lazy = true.

Comment on lines 4 to 5
event = "User AstroFile",
ft = { "yaml", "json" },
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
event = "User AstroFile",
ft = { "yaml", "json" },
lazy = true,

this should be reverted. This is more performant as is. It is lazy loaded based on module only when needed.

Copy link
Member

@mehalter mehalter left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I went in and resolved the performance issues. Thanks!

@mehalter mehalter merged commit 21d5729 into AstroNvim:main Apr 10, 2024
10 of 12 checks passed
This was referenced Apr 10, 2024
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

Successfully merging this pull request may close these issues.

None yet

4 participants