Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Improve performance of UseConsistentIndentation even more > another 10% speedup for formatter#1461

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 ourterms of service andprivacy statement. We’ll occasionally send you account related emails.

Already on GitHub?Sign in to your account

Conversation

@bergmeister
Copy link
Collaborator

PR Summary

This now reduced the total CPU time of this rule to only from 12% to 2% on a run of a warm run Invoke-Formatter (compared to current master with the 3 recent speed improvements). Improvements will be smaller for smaller scripts as this was tested against PowerShell's build.psm1 3000+ line module (same as with previous PRs), therefore it rather ensures performance scales much better.
Basically, because the rule goes over every token, any looping, inside it, even when it is only performed for each line as in this case, it has a measurable impact (both in the profiler but also actual timings). Therfore making sure we iterate over fewer items in thepipelineAsts list, by having a minimum index, which increases with each line and breaking the loop early if the line number is bigger than the current line. This is possible because the queried functionPositionIsEqual only returns pipeline asts on the same line.

PR Checklist

rjmholt reacted with heart emoji
Copy link
Contributor

@rjmholtrjmholt left a comment

Choose a reason for hiding this comment

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

Really awesome! Honestly I think removing LINQ use generally from PSSA could provide performance boosts across the board

Co-Authored-By: Robert Holt <rjmholt@gmail.com>
@bergmeister
Copy link
CollaboratorAuthor

bergmeister commentedApr 24, 2020
edited
Loading

Honestly I think removing LINQ use generally from PSSA could provide performance boosts across the board

Now, Linq consumers 18.5% of the CPU (but this include everything including SMA, therefore it is hard to say how much of that stems from PSSA only), so there is some potential but it's not as big as one would think.

image

@bergmeisterbergmeister changed the titleImprove performance of UseConsistentIndentation -more > another 10% speedup for formatterImprove performance of UseConsistentIndentation even more > another 10% speedup for formatterApr 24, 2020
@bergmeisterbergmeister merged commiteefa971 intoPowerShell:masterApr 24, 2020
Sign up for freeto join this conversation on GitHub. Already have an account?Sign in to comment

Reviewers

@JamesWTruherJamesWTruherAwaiting requested review from JamesWTruher

1 more reviewer

@rjmholtrjmholtrjmholt approved these changes

Reviewers whose approvals may not affect merge requirements

Assignees

No one assigned

Projects

None yet

Milestone

No milestone

Development

Successfully merging this pull request may close these issues.

3 participants

@bergmeister@rjmholt@JamesWTruher

[8]ページ先頭

©2009-2025 Movatter.jp