Skip to content

Conversation

bergmeister
Copy link
Collaborator

PR Summary

Speedup is relative to the speed BEFORE my recent 2 PRs so that one sees the impact relative to those improvments (therefore the actual speedup relative to master would actually be higher). Speed is for a call of Invoke-Formatter with the default settings of the VS-Code extension.
Because the rule already loops through all tokens, there was a line that did a search through all tokens and the list of tokens can be quite long for big scripts.
First improvement would've been to create a list just consisting of pipeline tokens but even then I still saw some overhead just because it had to loop the whole list again. Therefore I optimized it further to just walk back on the current line, which is the only line of interest.
If we take this improvement and the previous 2 PRs together, then the formatter is nearly 3 times faster in total.

PR Checklist

@bergmeister bergmeister merged commit 5f30746 into PowerShell:master Apr 24, 2020
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.

3 participants