Skip to content

Slow performance/High CPU utilization for syntax highlighting comments with built-in PowerShell extension #56476

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

Closed
Wombatzoner opened this issue Aug 15, 2018 · 4 comments
Assignees

Comments

@Wombatzoner
Copy link

Issue Type: Bug

  1. Create .ps1 file with the PowerShell comment block below in it.
  2. Open the file in VS Code with the built-in Powershell Language Basics extension enabled.

VS Code CPU utilization goes way up and it takes several minutes to complete the syntax highlighting.

Comment block:

<#
.SYNOPSIS
    Script to send report on NAP Group Issues, Computer Aging, Misfiled Computer and Legacy OS via e-mail.
.DESCRIPTION
    Script to send report on NAP Group Issues, Computer Aging, Misfiled Computer and Legacy OS via e-mail.

    By name redacted - Organization redacted - e-mail redacted
.PARAMETER ConfigFile
    XML configuration file containing the script's settings.  Defaults to Report-NAPOS-Config.xml if not otherwise specified.
.NOTES
    By name redacted - Organization redacted - e-mail redacted

    v1.0 - Sep 19, 2014 - Initial release.
    v1.1 - Sep 26, 2014 - Added reporting on Windows XP and Server 2003 systems found.
                          Added Summary section, updated report wording.
    v1.2 - Oct 03, 2014 - Switched to pipeline output from OSCheck-BL instead of writing result to a file.
                          Checks IP of computers in top Computer container for a Organization redacted IP in addition to name starting with redacted.
                          Updated report wording.
    v1.3 - Oct 16, 2014 - Switched to CSS to control table formatting.
                          Computer name prefix and IP range to search for in top Computer containers now set as configuration variable.
                          Log-Item now sends output to the console and the log file.
    v2.0 - Oct 20, 2014 - Switched to XML file to store script options, CSS file to store style sheet.
    v2.1 - Oct 24, 2014 - Switched to regular expressions to specify search and exclude filters.
                          Streamlined report generation code.
    v2.2 - Oct 31, 2014 - Presence or absence of all report sections (NAP, Aging, Misfiled, Legacy OS) now set in the configuration file.
                          Search OU for all sections except Misfiled Computers now set in configuration file.
                          Moved section specific settings to their section of the config file.
                          Added support for inline timestamps for Subject, MessageHeader, and MessageFooter.
                          Added option to save copy of report to HTML file.
                          Updated report formatting and wording.
    v2.3 - Nov 07, 2014 - Configuration.ReportSettings.Aging.RemovalDays can now being empty or missing.
                          Fixed name anchors enclosing summary titles, which was causing a minor rendering issue in iOS Mail.
                          Added explicit loading of System.Web assembly to fix issue with calls to [System.Web.HttpUtility]::HtmlDecode().
                          Standardized formatting of calls to ConvertTo-Html and Select-Object.
    v2.4 - Nov 13, 2014 - Switched to pipeline output from NAP-Group-Check instead of writing result to a file.
                          Added support for -groupSearchBase setting required by NAP-Group-Check to verify NAP groups.
                          Added support for sorting report sections by their properties.
                          Changed ShowIfEmpty attributes to all lowercase per XML Schema specification.
    v2.5 - Dec 19, 2014 - Added support for checking MAB accounts for issues.
                          Improved Terminate-Script error reporting. Now using Throw to terminate script with error information.
                          Removed unused parameters from call to NAP-Group-Check.
                          Updated capitalization and spacing in the report text.
    v2.5.1 - Apr 26, 2016 - Now calling Send-MailMessage with -ErrorAction Stop so it throws an error for the try/catch block to catch.
                            Terminate-Script now uses $ErrorRecord.InvocationInfo.ScriptName instead of $MyInvocation.ScriptName.
                            Terminate-Script now throws $Message if $ErrorRecord not set.
    v2.5.2 - Mar 20, 2017 - Switched from System.Web.HttpUtility.HtmlDecode to System.Net.WebUtility.HtmlDecode to generate summary table.
    v2.6 - Oct 2, 2017 - Added option to specify a regex for OperatingSystemVersion in Configuration.ReportSettings.Legacy entries.
                         Added OperatingSystemVersion to the Legacy OS report tables.
                         Added Action column to age report section for easier use with computer removal script.
#>

VS Code version: Code 1.26.0 (4e93618, 2018-08-13T16:29:31.933Z)
OS version: Windows_NT x64 10.0.17134

System Info
Item Value
CPUs Intel(R) Core(TM) i7-6600U CPU @ 2.60GHz (4 x 2808)
GPU Status 2d_canvas: enabled
checker_imaging: disabled_off
flash_3d: enabled
flash_stage3d: enabled
flash_stage3d_baseline: enabled
gpu_compositing: enabled
multiple_raster_threads: enabled_on
native_gpu_memory_buffers: disabled_software
rasterization: enabled
video_decode: enabled
video_encode: enabled
webgl: enabled
webgl2: enabled
Memory (System) 15.90GB (8.10GB free)
Process Argv C:\Users\eforsythe0002\AppData\Local\Programs\Microsoft VS Code\Code.exe
Screen Reader no
VM 0%
Extensions (3)
Extension Author (truncated) Version
githistory don 0.4.2
xml Dot 2.3.1
git-project-manager fel 1.6.1
@Serega124
Copy link

Bisected example:

<#
                        .
#>

@Serega124
Copy link

powershell.tmLanguage.json line 414 has catastrophic backtracking:
(?:\\s*|#)+(\\.)
Changing it to (?:\\s?|#)+(\\.) seems ok.

@Serega124
Copy link

@aeschli already reverted it to older commit.

@aeschli
Copy link
Contributor

aeschli commented Aug 16, 2018

duplicate of #56430

@aeschli aeschli closed this as completed Aug 16, 2018
@vscodebot vscodebot bot locked and limited conversation to collaborators Sep 30, 2018
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants