Title: Bad performance feedback loop with slow PSScriptAnalyzer rules · Issue #2260 · PowerShell/PowerShellEditorServices · GitHub
Open Graph Title: Bad performance feedback loop with slow PSScriptAnalyzer rules · Issue #2260 · PowerShell/PowerShellEditorServices
X Title: Bad performance feedback loop with slow PSScriptAnalyzer rules · Issue #2260 · PowerShell/PowerShellEditorServices
Description: Prerequisites I have written a descriptive issue title. I have searched all open and closed issues to ensure it has not already been reported. I have read the troubleshooting guide. I am sure this issue is with PowerShell Editor Services...
Open Graph Description: Prerequisites I have written a descriptive issue title. I have searched all open and closed issues to ensure it has not already been reported. I have read the troubleshooting guide. I am sure this ...
X Description: Prerequisites I have written a descriptive issue title. I have searched all open and closed issues to ensure it has not already been reported. I have read the troubleshooting guide. I am sure this ...
Opengraph URL: https://github.com/PowerShell/PowerShellEditorServices/issues/2260
X: @github
Domain: github.com
{"@context":"https://schema.org","@type":"DiscussionForumPosting","headline":"Bad performance feedback loop with slow PSScriptAnalyzer rules","articleBody":"### Prerequisites\n\n- [x] I have written a descriptive issue title.\n- [x] I have searched all [_open and closed_ issues](https://github.com/PowerShell/PowerShellEditorServices/issues?q=is%3Aissue) to ensure it has not already been reported.\n- [x] I have read the [troubleshooting](https://github.com/PowerShell/vscode-powershell/blob/main/docs/troubleshooting.md) guide.\n- [x] I am sure this issue is with _PowerShell Editor Services itself_ and does not reproduce in a standalone [PowerShell](https://github.com/PowerShell/PowerShell/issues/new/choose) instance, and is not an issue with my editor.\n- [x] I have verified that I am using the latest version of PowerShell Editor Services.\n- [ ] If this is a security issue, I have read the [security issue reporting guidance](https://github.com/PowerShell/vscode-powershell/blob/main/SECURITY.md).\n\n### Summary\n\nI'm running into a script analysis performance issue in my environment. We have a decent number of custom PSScriptAnalyzer rules that can take more than several seconds to complete with larger scripts.\n\nAs you're typing in a PowerShell document, the responsiveness of script analysis deteriorates to the point were you have to wait many times more than the usual run duration of the rules to see most up-to-date analysis results.\n\nThis is happening because every time you stop typing for \u003e750ms PSES fires off another multi-second `Invoke-ScriptAnalyzer` run into the pssaRunspacePool (which has a concurrency of 1). So with a lot of furious typing, script analysis service can end up with tens of seconds of work just to catch-up to the document contents that are on the screen at the moment.\n\nI've come up with a fix that boils down to holding off `Invoke()`'ing a new scan until the currently running one completes. That gives a chance for any more incoming document changes to pre-empt ones that have not started scanning yet. As a result, the scanning results delay is more or less stable and not worse than the runtime of all of the rules.\n\nI need to do more testing of the fix, but was wondering if anyone else has run into this? Maybe there would be a better way to fix it? Planning to submit a PR for this at some point.\n\n\n\n### PowerShell Version\n\n```console\name Value\n---- -----\nPSVersion 7.4.11\nPSEdition Core\nGitCommitId 7.4.11\nOS Microsoft Windows 10.0.22631\nPlatform Win32NT\nPSCompatibleVersions {1.0, 2.0, 3.0, 4.0…}\nPSRemotingProtocolVersion 2.3\nSerializationVersion 1.1.0.1\nWSManStackVersion 3.0\n```\n\n### Editor Version\n\n```console\nVSCode\n------\nVersion: 1.104.3 (system setup)\nCommit: 385651c938df8a906869babee516bffd0ddb9829\nDate: 2025-10-02T12:30:51.747Z\nElectron: 37.3.1\nElectronBuildId: 12404162\nChromium: 138.0.7204.235\nNode.js: 22.18.0\nV8: 13.8.258.31-electron.0\nOS: Windows_NT x64 10.0.22631\n```\n\n### PowerShell Editor Services Version\n\n```console\nMajor Minor Build Revision\n----- ----- ----- --------\n4 3 0 0\n```\n\n### Steps to Reproduce\n\n1. Create a custom PSScriptAnalyzer rule that takes 5s to run (easier to reproduce the issue with longer delays).\n2. Type, wait 1 second, type, wait 1 second, type, wait 1 second, type.\n3. Observe that after stopping typing script analysis will continue running for the next ~15s and will return all of the intermediate results as you were typing. As an interactive user I only care about analysing the document that is on the screen now.\n\n### Visuals\n\n_No response_\n\n### Logs\n\n_No response_","author":{"url":"https://github.com/Tadas","@type":"Person","name":"Tadas"},"datePublished":"2025-10-20T13:06:00.000Z","interactionStatistic":{"@type":"InteractionCounter","interactionType":"https://schema.org/CommentAction","userInteractionCount":1},"url":"https://github.com/2260/PowerShellEditorServices/issues/2260"}
| route-pattern | /_view_fragments/issues/show/:user_id/:repository/:id/issue_layout(.:format) |
| route-controller | voltron_issues_fragments |
| route-action | issue_layout |
| fetch-nonce | v2:3fc425ed-c1a5-c69e-4015-96d5505eab44 |
| current-catalog-service-hash | 81bb79d38c15960b92d99bca9288a9108c7a47b18f2423d0f6438c5b7bcd2114 |
| request-id | E0E4:1749AA:7B9B0D:A87ED2:6A571379 |
| html-safe-nonce | 9181c2ac8409366a240fcee0ec6160e8eba2868a2168d932afb98eea54fd01ea |
| visitor-payload | eyJyZWZlcnJlciI6IiIsInJlcXVlc3RfaWQiOiJFMEU0OjE3NDlBQTo3QjlCMEQ6QTg3RUQyOjZBNTcxMzc5IiwidmlzaXRvcl9pZCI6IjE5NTYwMzQ1ODkyMTE2OTM5NDUiLCJyZWdpb25fZWRnZSI6ImlhZCIsInJlZ2lvbl9yZW5kZXIiOiJpYWQifQ== |
| visitor-hmac | 31d8f815b4b32ed032a9363f5ce80bbd9d5ea71dbc54e0465f3d5c5dab099200 |
| hovercard-subject-tag | issue:3532378332 |
| github-keyboard-shortcuts | repository,issues,copilot |
| google-site-verification | Apib7-x98H0j5cPqHWwSMm6dNU4GmODRoqxLiDzdx9I |
| octolytics-url | https://collector.github.com/github/collect |
| analytics-location | / |
| fb:app_id | 1401488693436528 |
| apple-itunes-app | app-id=1477376905, app-argument=https://github.com/_view_fragments/issues/show/PowerShell/PowerShellEditorServices/2260/issue_layout |
| twitter:image | https://opengraph.githubassets.com/918893f36a8f0f97a4e718a7f80c37b9edbbc98fea54aa37713bc3e8717b9f55/PowerShell/PowerShellEditorServices/issues/2260 |
| twitter:card | summary_large_image |
| og:image | https://opengraph.githubassets.com/918893f36a8f0f97a4e718a7f80c37b9edbbc98fea54aa37713bc3e8717b9f55/PowerShell/PowerShellEditorServices/issues/2260 |
| og:image:alt | Prerequisites I have written a descriptive issue title. I have searched all open and closed issues to ensure it has not already been reported. I have read the troubleshooting guide. I am sure this ... |
| og:image:width | 1200 |
| og:image:height | 600 |
| og:site_name | GitHub |
| og:type | object |
| og:author:username | Tadas |
| hostname | github.com |
| expected-hostname | github.com |
| None | 4e7a7296a3830877cf21a6ad2a972c9e618a48915e03966cf0c53eb08e5aad98 |
| turbo-cache-control | no-preview |
| go-import | github.com/PowerShell/PowerShellEditorServices git https://github.com/PowerShell/PowerShellEditorServices.git |
| octolytics-dimension-user_id | 11524380 |
| octolytics-dimension-user_login | PowerShell |
| octolytics-dimension-repository_id | 36031537 |
| octolytics-dimension-repository_nwo | PowerShell/PowerShellEditorServices |
| octolytics-dimension-repository_public | true |
| octolytics-dimension-repository_is_fork | false |
| octolytics-dimension-repository_network_root_id | 36031537 |
| octolytics-dimension-repository_network_root_nwo | PowerShell/PowerShellEditorServices |
| turbo-body-classes | logged-out env-production page-responsive |
| disable-turbo | false |
| browser-stats-url | https://api.github.com/_private/browser/stats |
| browser-errors-url | https://api.github.com/_private/browser/errors |
| release | 2576d1f0198cf1588faf2edf27f1ed120903be10 |
| ui-target | full |
| theme-color | #1e2327 |
| color-scheme | light dark |
Links:
Viewport: width=device-width