-
-
Notifications
You must be signed in to change notification settings - Fork 805
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
Add build module #698
base: master
Are you sure you want to change the base?
Add build module #698
Conversation
Rather than put this in a top-level
|
Awesome, I've applied both your suggestions. Shall I adapt the build as part of this PR as well to test against the built version? |
That would be great. Maybe add build script parameters along the lines of |
…(works for Appveyor and Travis)
For the moment I make it conditionally use the built folder based on the existence of the |
@@ -1,4 +1,9 @@ | |||
$modulePath = Convert-Path $PSScriptRoot\..\src | |||
# Test against built folder in CI (or just set $env:CI locally for that) | |||
if ($env:CI) { |
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 works on a build machine. Can we also add a PowerShell variable check here like:
if ($env:CI -or $PoshGitBuild)
That way if we build & test from the build.ps1 script on a dev machine, it will run the Pester tests against the release dir. And because that $PoshGitBuild variable goes away after the build script exits, I can still run tests from the src folder module when I doing dev work.
Where is the definition of the Travis build so that I can add the call to the build script? Otherwise I'll have to change the code to only use the build if the build version directory exists. |
PR is ready to review now |
I'm seeing about a 176 out of 1242 mS improvement on startup or about a 14% improvement. That's good but not as good as I'd hoped. Here's how I tested:
That said, I'm still in favor of merging this. @dahlbyk What do you think? This impacts your build & release process. |
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.
LGTM
Yes, I also found the speed-up when the import happens in $PROFILE or directly after the startup is only 10-20%. When the import happened in an idle PowerShell session manually, then the the import was twice as fast. I can only guess that there are other threads that are still active immediately after PS startup that reduce the resources available for the speedup and therefore lead to a smaller speedup. |
@bergmeister thanks for improving startup times! It has been annoying with powershell 6, which is twice as to load than powershell 5. |
Also helps with #635 |
bump? Would be nice to improve startup times if this helps with that. |
Can we merge this in? I don't know why, but my PS Core takes long to start when I have posh-git installed. |
@rkeithhill @dahlbyk Can you please speedup the review process or if one of you two is busy I expect the other person to take over? It's been nearly a year now! I would not want to do it but otherwise I will consider publishing a forked version.... |
You know, some people actually do go on vacation. :-) But I'm back now. That said, I don't do the build/final publish of the module. That's something that only @dahlbyk can do AFAIK. So I've left this PR up to him to approve/merge. |
Yes I appreciate and respect that people go on holiday or are being busy for a while due to personal/work reasons, especially since this is an OSS project without company backing. But a year is what is called a sabbatical not vacation ;-) |
Understood. I've already approved this but @dahlbyk needs to as well and he's a very busy fellow these days. 🤷♂️ |
Burnout. Worse this year than in the past. I have the few weeks off work, so hoping to dig back into posh-git during that time. Appreciate your contribution and patience. |
Sorry to hear that and recovery has priority in this case @dahlbyk. How would you feel about handing the maintenance/ownership over to @rkeithhill (assuming he'd be happy with that) to help you relieve from the burden/pressure of maintenance. |
I do want to mention that the extremely slow pwsh load times already is a big grievance for powershell users (see this 2 year old issue PowerShell/PowerShell#6443 (comment)). I use posh-git everyday, but it adds a painful 0.5s to 1s to my load time. For example see also this user with similar reports: PowerShell/PowerShell#6443 (comment) I do want to thank the work of the development team in trying to improve the situation. |
@musm To set expectations if this PR is merged, the perf improvement is only in the range of 10-20%. |
Related: #692
This targets the
master
branch.It creates the module in an
out
folder by copying the content of thesrc
folder into it first and then merging the.ps1
files into the main.psm1
files that are dot sourced by looking for the pattern$PSScriptRoot\ScriptName.ps1
and replacing it with the content and wrapping it into a#region
block. The result is stored in a folder with the name being the version, so that one can just add to to the PSModulePath env variable if one wanted to.This cuts the import time roughly in half for a pure import from a started up PS (from 800 to 400 ms on my machine) or reduced the import time by 25% when the import happens in the $PROFILE (don't know why the benefit is smaller in this case but probably because the import is generally slow in the $Profile due to PS being busy at the start)
I've adapted the test logic to use the built module if the
CI
env variable is set and the path exists and in AppVeyor I keep running tests the old way, then build and then make them run against the built moduleI've adapted the test logic to use the