X Tutup
The Wayback Machine - https://web.archive.org/web/20230815122041/https://github.com/PowerShell/PowerShell/pull/17330
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

WIP: Add PSConfig.json field to override threshold for slow profile loading msg #17330

Conversation

rkeithhill
Copy link
Collaborator

PR Summary

This PR adds a field to the powershell.config.json file to allow the end user to set the time threshold for showing the "slow profile loading" message. Fixes #16929.

This is WIP because I haven't looked into the test impact yet (and have not written any new tests). Before I do that I'd like to get a nod that the PR would be accepted.

I also expect some debate on what the JSON field should be named. The proposed name is descriptive but perhaps a bit too long - SlowProfileLoadingMessageThreshold.

PR Context

To address and fix issue #16929. See the issue for the complete rationale for this PR.

PR Checklist

int showMessageThresholdMs = 500;

int thresholdMs = PowerShellConfig.Instance.GetSlowProfileLoadingMessageThreshold(ConfigScope.AllUsers);
if (thresholdMs > 0)
Copy link
Collaborator

Choose a reason for hiding this comment

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

What if the config contains 0 or -1 value?

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

The current impl would ignore <= 0 so you'd get the default 500 milliseconds. I suppose I could change that to threshold >= 0 so if the user set it to 0, you'd always see the slow profile loading message. That's a bit odd because then it is no longer about slow profile loading but is instead "always show my profile load time". Then again a threshold of 1 ms is more or less the same.

Part of the problem with this approach to current user setting overriding the global setting is that I'm relying on a default value of 0 to indicate the setting is not set in that config file. I should probably just make the PowerShellConfig property return int? and use that instead to see if the value was set in the corresponding config file. Then 0 could literally mean the threshold is 0 ms and any negative number could mean the threshold is infinite.

@TravisEz13
Copy link
Member

PR to fix container failure: #17338

@TravisEz13
Copy link
Member

/rebase

@github-actions github-actions bot force-pushed the rkeithhill/slow-profile-loading-msg-threshold branch from 6098e5e to cdf0234 Compare May 13, 2022 17:37
@pull-request-quantifier
Copy link

This PR has 12 quantified lines of changes. In general, a change size of upto 200 lines is ideal for the best PR experience!


Quantification details

Label      : Extra Small
Size       : +10 -2
Percentile : 4.8%

Total files changed: 2

Change summary by file extension:
.cs : +10 -2

Change counts above are quantified counts, based on the PullRequestQuantifier customizations.

Why proper sizing of changes matters

Optimal pull request sizes drive a better predictable PR flow as they strike a
balance between between PR complexity and PR review overhead. PRs within the
optimal size (typical small, or medium sized PRs) mean:

  • Fast and predictable releases to production:
    • Optimal size changes are more likely to be reviewed faster with fewer
      iterations.
    • Similarity in low PR complexity drives similar review times.
  • Review quality is likely higher as complexity is lower:
    • Bugs are more likely to be detected.
    • Code inconsistencies are more likely to be detetcted.
  • Knowledge sharing is improved within the participants:
    • Small portions can be assimilated better.
  • Better engineering practices are exercised:
    • Solving big problems by dividing them in well contained, smaller problems.
    • Exercising separation of concerns within the code changes.

What can I do to optimize my changes

  • Use the PullRequestQuantifier to quantify your PR accurately
    • Create a context profile for your repo using the context generator
    • Exclude files that are not necessary to be reviewed or do not increase the review complexity. Example: Autogenerated code, docs, project IDE setting files, binaries, etc. Check out the Excluded section from your prquantifier.yaml context profile.
    • Understand your typical change complexity, drive towards the desired complexity by adjusting the label mapping in your prquantifier.yaml context profile.
    • Only use the labels that matter to you, see context specification to customize your prquantifier.yaml context profile.
  • Change your engineering behaviors
    • For PRs that fall outside of the desired spectrum, review the details and check if:
      • Your PR could be split in smaller, self-contained PRs instead
      • Your PR only solves one particular issue. (For example, don't refactor and code new features in the same PR).

How to interpret the change counts in git diff output

  • One line was added: +1 -0
  • One line was deleted: +0 -1
  • One line was modified: +1 -1 (git diff doesn't know about modified, it will
    interpret that line like one addition plus one deletion)
  • Change percentiles: Change characteristics (addition, deletion, modification)
    of this PR in relation to all other PRs within the repository.


Was this comment helpful? 👍  👌  👎 (Email)
Customize PullRequestQuantifier for this repository.

@msftbot msftbot bot added the Review - Needed The PR is being reviewed label May 26, 2022
@msftbot
Copy link

msftbot bot commented May 26, 2022

This pull request has been automatically marked as Review Needed because it has been there has not been any activity for 7 days.
Maintainer, please provide feedback and/or mark it as Waiting on Author

@rkeithhill
Copy link
Collaborator Author

@daxian-dbw Any thoughts on whether this PR is something the team would be interested in taking?

@daxian-dbw
Copy link
Member

The WG-Interactive-Console working group needs to triage the issue. From a quick look of the change, it's not clear to me how this will work with pwsh -settingsfile flag. But you may want to wait on addressing that until after the WG agrees to accept this change.

@msftbot msftbot bot removed the Review - Needed The PR is being reviewed label Jun 3, 2022
@daxian-dbw
Copy link
Member

@rkeithhill Given the comment #16929 (comment), you may want to close this PR.

@rkeithhill rkeithhill closed this Jun 9, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Consider adjusting threshold for showing the load time for personal & system profiles to 1 sec
5 participants
X Tutup