-
-
Notifications
You must be signed in to change notification settings - Fork 282
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
modules/performance: add an option to combine plugins to a single plugin pack #1886
Conversation
Can someone tell me what test is failing? For me evaluation takes too much RAM for my VM, so nix is getting killed by oom-killer. |
Am I wrong thinking that buildbot instances also have not enough memory? All this strange |
We have some issues currently with buildbot :/ |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This looks interesting! Thanks for working on it!
Unfortunately our CI is having issues atm so it's difficult to know with confidence nothing is broken. Hopefully this'll be resolved soon.
I'm pleased to see additional tests added, hopefully they cover most edge-cases?
I haven't got time to fully digest this right now, but I've left some initial thoughts below.
# planets picker requires files in data/memes/planets | ||
performance.combinePlugins.pathsToLink = [ "/data/memes/planets" ]; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Having to define this explicitly feels fragile... What would happen if we add another plugin module but don't notice we need to define addition paths to link?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
What would happen if we add another plugin module but don't notice we need to define addition paths to link?
Additional paths will be missing from user runtime if combinePlugins
is enabled, so it depends on what files are missing. For telescope here, it pretty much doesn't matter, because planets is a picker that is only for testing. Most plugins doesn't need any paths except standard.
I think in a description of this options should be clear, that this option is experimental, doesn't give any guaranties etc. So if it works for user's config, he'll get a performance boost, if not — sorry. I've added EXPERIMENTAL to the description for that purpose. But English is not native for me, if you have better description, we can update it.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think the description is good. I think we can support this feature with less guarantees on breaking changes, i.e we won't add tests for all the plugins trying to enable the option, as this might be a too large maintenance burden, but we'll gladly include workarounds if people suggest them
In a sibling PR all test are passed for two out of four arches. Those PR is branched on top of this, so I think all tests are passing. But to be honest I've noticed that most of the tests doesn't actually test functionality, only that config generated is valid and setup function is successful. In my tests I tried to test that my functionality actually work. Link to the x86_64 tests from a sibling PR: https://buildbot.nix-community.org/#/builders/146/builds/227 |
199745c
to
cb72126
Compare
@stasjok FYI we recently merged a PR that seemed to massively decrease the amount of RAM used by the tests |
I've already rebased, but all tests are still |
That's a separate issue that should only affect buildbot (our CI). See nix-community/buildbot-nix#227.
This should make it easier to run tests locally. Local tests should be unaffected by the broken pipe issue. |
# planets picker requires files in data/memes/planets | ||
performance.combinePlugins.pathsToLink = [ "/data/memes/planets" ]; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think the description is good. I think we can support this feature with less guarantees on breaking changes, i.e we won't add tests for all the plugins trying to enable the option, as this might be a too large maintenance burden, but we'll gladly include workarounds if people suggest them
Thank you very much for this feature, and especially thank you for the in-depth tests, they make me much more confident that we can maintain this feature without it breaking silently! |
6c85285
to
1deb17c
Compare
Could you rebase on main, we should have fixed our CI problems! |
It's expected that user may want to override some runtime files in its own config directory. Do not combine it into plugin pack to avoid collisions.
1deb17c
to
c85bb99
Compare
I hate this error:
We are going to need to disable this test on darwin |
This would a nice feature, while it does not have many performance benefits, I find annoying having so many useless entries! |
@Mergifyio queue |
🛑 The pull request has been merged manuallyThe pull request has been merged manually at 0ac10f6 |
It seemed to work, can you squash the test in the tree-sitter implementation? |
…ToLink plenary.nvim is often pulled as a dependency of other plugins. It has filetype definitions in `data/plenary/filetypes` directory. Even though I don't think there are plugins using it instead of vim.filetype, but it should be no harm to add this directory by default.
918b47d
to
435713d
Compare
I've implemented it here: https://github.com/stasjok/nixvim/commits/optimize-rtp/ (last two commits), but I don't like it much, that's why I haven't submitted a PR. It turns out somewhat awkward having this in the performance namespace with the options to add extra paths to rtp: In the codebase I need to check So my thoughts are, if there is an interest in this feature, it shouldn't be
In the end since all above as pretty large refactor and it should also change how things are managed right now, I put this task aside and decided to just change my lua code with a simple nix config in my config (in home-manager options I can get a static paths to my config files, to plugin path and to Nvim runtime, so no lua loops and matching needed, just plain vim.o.runtimepath assignment. |
Yeah I agree that it's something that we should do by default, we already do some modifications of the runtime path, so it wouldn't be too out of place |
@stasjok thank you very much for that feature, it halved my startup time! From around 230ms to 100ms |
Glad it worked for you! |
Hey. I'm the one from this comment in [Feature] Lazy loading issue. I decided to give nixvim a try, but since I don't want to lose my performance optimizations, I implemented them in nixvim. Since my comment have got a couple of upvotes, here I am with a PR. I don't know if this would be merged, since this feature have caveats. But if it works for your config, you'll get a free performance boost (startup time and every time you
:e
a buffer). It's optional, so it shouldn't brake existing configs. I still think that this is more important than trying to lazy load everything (but for some specific cases lazy loading is also useful).I'm planning to implement three performance options:
To get you interested here are startuptime measurements (all measurements are taken from my config after a couple of tries with a hot disk cache):
vim.loader.enable()
without everything from the above: 115-120 msThis PR adds a
performance.combinePlugins
option with two tunables:pathsToLink
for choosing what paths are linked to plugin pack andstandalonePlugins
for specifying what plugins to exclude from combining. Last option is important, because for combining to work there must not be any file and doc tag collisions. Good news is if it builds, most of the time it would work correctly (except when some paths need to be added topathsToLink
).Also this PR adds a couple of examples on how to fix errors in nixvim on a per plugin case (so most of the time user wouldn't need to configure anything). This is not all problematic plugins, but the ones I have in my config (to get this PR usable). Bad news came from a recent nixpkgs PR NixOS/nixpkgs#321550. After that PR parser queries are colliding with treesitter plugins. It can be fixed in user overlay (example), or like in this PR with nvim-treesitter (to exclude plugins containing a collection of queries from combining), or
meta.priority
can also be used. Because of this issue I even wanted to introduce a second layer of combined plugins, but for now a completely separate plugins would suffice. If the list of such exclusions will be too large, than it can be reevaluated.