FazBrowse GitHub Viewer | Trending |
URL:
| Home
Tools: [Download Repo ZIP]   [Original HTTPS Page]

Avoid using closure in `Parser.SaveError` by daxian-dbw · Pull Request #11006 · PowerShell/PowerShell · GitHub

Avoid using closure in Parser.SaveError - #11006

Merged
1 commit merged into
PowerShell:masterfrom
daxian-dbw:saveerror
Nov 8, 2019
Merged

Avoid using closure in Parser.SaveError#11006
1 commit merged into
PowerShell:masterfrom
daxian-dbw:saveerror

Conversation

Dongbo Wang (daxian-dbw) commented Nov 7, 2019
edited
Loading

Copy link
Copy Markdown
Member

PR Summary

Avoid using closure in Parser.SaveError.

Context

Generally, Parser.SaveError shouldn't be called too frequently in production, because the script running in production should have been correct and generate no parsing error.
However, I saw the following call stack in Azure Profiler Viewer for PowerShell Gallery-Prod service:

Parser.SaveError takes about 43.56% of the CPU activities in the web server process w3wp.exe, and the call originates from NuGetGallery.Views.ScriptParsingAndHighlighting!Parse

Given the finding, I took a look at the implementation of Parser.SaveError and notice that it's using closure and LINQ unnecessarily. Especially, the closure use will cause allocation every time this method is called.
As for why PowerShellGallery triggers so many parsing errors, it's because it's parsing non-powershell files using powershell parser, which is wrong and will be fixed.

PR Checklist

Dongbo Wang (daxian-dbw) added the CL-Performance Indicates that a PR should be marked as a performance improvement in the Change Log label Nov 7, 2019
Ilya (iSazonov) added this to the 7.0.0-preview.6 milestone Nov 7, 2019

Copy link
Copy Markdown
Member

PoshChan-Bot (@PoshChan) Please remind me in 4 hours.

Aditya Patwardhan (adityapatwardhan) added the AutoMerge informs the bot to automerge the PR label Nov 7, 2019

Copy link
Copy Markdown

Hello Aditya Patwardhan (@adityapatwardhan)!

Because this pull request has the AutoMerge label, I will be glad to assist with helping to merge this pull request once all check-in policies pass.

Do note that I've been instructed to only help merge pull requests of this repository that have been opened for at least 24 hours, a condition that will be fulfilled in about 4 hours 7 minutes. No worries though, I will be back when the time is right! 😉

p.s. you can customize the way I help with merging this pull request, such as holding this pull request until a specific person approves. Simply @mention me (@msftbot) and give me an instruction to get started! Learn more here.

Copy link
Copy Markdown
Collaborator

Aditya Patwardhan (@adityapatwardhan), this is the reminder you requested 4 hours. ago

ghost merged commit fff137e into PowerShell:master Nov 8, 2019
Dongbo Wang (daxian-dbw) deleted the saveerror branch November 8, 2019 01:00

Copy link
Copy Markdown

🎉v7.0.0-preview.6 has been released which incorporates this pull request.:tada:

Handy links:

Thatgfsj (Thatgfsj) pushed a commit to Thatgfsj/PowerShell that referenced this pull request Aug 6, 2026
This pull request was closed.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode characters
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

AutoMerge informs the bot to automerge the PR CL-Performance Indicates that a PR should be marked as a performance improvement in the Change Log

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants


Back | FazBrowse Home | New Git URL