-
-
Notifications
You must be signed in to change notification settings - Fork 264
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
Refactor: decrease cost of requiring main module #331
Conversation
Hmm, looks like this interacts with the CI tests in an unexpected way; I'll have to take a look to see why those failed. EDIT: We can ignore the test failures for the moment, but the tests should be updated as part of this PR. The failures are happening because the current tests don't trigger the deferred management of plugin specifications that this PR adds. |
This looks good @wbthomason excited to see the automatic recompilation land. I'll test this out later on today |
@wbthomason just tried this out, profile and status seem to work fine although when I run
error and then subsequent attempts to run the command work fine. |
@akinsho I've fixed the issue with This does expose that we should add some early-exit logic for an empty plugin set, though. |
@wbthomason just tested this again and it seems to work fine. |
Seems to work fine on my machine as well, and requiring the main |
Thanks for trying this out! I think this is ready to merge once I fix the tests. |
I'm not sure it goes here or not . Though it's probably going to be a big refractor I think everyone will have a lot less headache for everyone at the end if packer just loaded the configuration directly instead of compiling it . Ok . I just had to say it . I've been banging my head on packers config for over an hour because I have mistakenly used @wbthomason can you at least please take a look at #343 with that at least other plugins wont be affected when error occurs in a plugin . Pardon me if I sound rough I'm just really frustrated right now . |
@shadmansaleh This PR is actually part of a move away from using I'll take a look at #343; it slipped off my radar. Sorry that I haven't had a lot of time for |
No problem . Everyone has their lives :) |
95294bb
to
cde7604
Compare
Fixed the tests and removed the unnecessary merge commit, so I think this is good to go. |
This PR reorganizes part of the main
packer
module to (1) defer the cost of managing each plugin until an operation is required, and (2) defer requiring and configuring the modules that implement the actual functionality ofpacker
. Together, this lowers the cost of requiring the mainpacker
module and adding plugin specifications from ~4ms to ~0.2ms on my setup.The motivation for this is as stage 1 of moving toward automatic compilation and some other major QoL improvements. By making it close to zero-cost to require
packer
, we make it practical to ask users to runstartup
or equivalent in theirinit.lua
files, which will make it easier to implement operations like auto-recompilation and hopefully using config/setup functions directly i.e. without theloadstring
dance and its restrictions.@akinsho: I've done some manual testing of this PR, enough to think it probably doesn't break anything. However, I'd appreciate a second set of eyes (or more if anyone else is willing) - there's a decent probability that this breaks some module by forgetting to configure it before it's used (previously, all modules were configured in the
init
function).