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

Worth adding optional timing output to def prompt? #371

Merged
merged 3 commits into from
Jan 17, 2017

Conversation

rkeithhill
Copy link
Collaborator

This is enabled with $GitPromptSettings.DefaultPromptEnableTiming=$true and then the prompt function outputs ~\GitHub\rkeithhill\posh-git [rkeithhill/enable-default-prompt-timing +0 ~2 -0 !] 55 mS>.

It also occurred to me that the GitPromptSettings should be prefixed "DefaultPrompt" so folks don't think they apply to their own custom prompt functions.

I'm not entirely sure this is worth it but I could see it coming in handy to get "hard" perf data from users of the default prompt. If we decide not to go with this PR, I still think we should consider adding the "Default" prefix to the existing two Prompt*Suffix settings.

In the VSCode dir on my machine (status equiv to origin), the prompt takes 150 mS. VSCode has 6466 files in the repo.

rkeithhill and others added 2 commits January 16, 2017 14:53
This is enabled with `$GitPromptSettings.DefaultPromptEnableTiming=$true` and then the prompt function outputs `~\GitHub\rkeithhill\posh-git [rkeithhill/enable-default-prompt-timing +0 ~2 -0 !] 55 mS>`.

It also occurred to me that the GitPromptSettings should be prefixed "DefaultPrompt" so folks don't think they apply to their own custom prompt functions.

I'm not entirely sure this is worth it but I could see it coming in handy to get "hard" perf data from users of the default prompt.  If  we decide not to go with this PR, I still think we should consider adding the "Default" prefix to the existing two Prompt*Suffix settings.

In the VSCode dir on my machine (status equiv to origin), the prompt takes 150 mS.  VSCode has 6466 files in the repo.
"123 mS" => "123ms"
@dahlbyk
Copy link
Owner

dahlbyk commented Jan 17, 2017

I like the idea. Added commit to compress the display: [branch] 55ms>...eh?

@@ -92,7 +92,7 @@ if (!$currentPromptDef -or ($currentPromptDef -eq $defaultPromptDef)) {
if ($GitPromptSettings.DefaultPromptEnableTiming) {
$sw.Stop()
$elapsed = $sw.ElapsedMilliseconds
Write-Host " $elapsed mS" -NoNewline
Write-Host " $($elapsed)ms" -NoNewline
Copy link
Collaborator Author

@rkeithhill rkeithhill Jan 17, 2017

Choose a reason for hiding this comment

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

Works for me. You can simplify that a bit " ${elapsed}ms". In interpolated strings in PowerShell, you can delineate variable names from other text with ${<variable-name>}.

@dahlbyk dahlbyk merged commit 73b8bf9 into master Jan 17, 2017
@dahlbyk dahlbyk deleted the rkeithhill/enable-default-prompt-timing branch January 17, 2017 03:10
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.

2 participants