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

Appearance settings

Combining the -replace operator with a lookbehind assertion slowed down by a factor of 30+ between v6.0.2 and v6.1.0-preview.2 #6976

Copy link
Copy link
@mklement0

Description

@mklement0
Issue body actions

Note: I have not tried to analyze whether the problem is in PowerShell or CoreFx; on the PowerShell side, new features were recently added to -replace - see #6029 - but I have no idea whether this symptom relates to that.

The problem appears to be specific to -replace; using -match does not exhibit the symptom.

Steps to reproduce

Run the following command line:

  • first on v6.0.2 (the current stable release as of this writing).

  • then on v6.1.0-preview.2 (the current preview release).

$arr =  (, 'fooo') * 1e6; (Measure-Command { $arr -replace '(?<=.{3}).+' }).TotalSeconds

Expected behavior

Similar timings.

Actual behavior

Here are sample timings, in seconds, from a Windows 10 VM:

# v6.0.2
1.8444752

# v6.1.0-preview.2
# !! more than 30 times slower
61.5428622

Environment data

PowerShell Core v6.0.2
PowerShell Core v6.1.0-preview.2
Reactions are currently unavailable

Metadata

Metadata

Assignees

Labels

Resolution-FixedThe issue is fixed.The issue is fixed.WG-Enginecore PowerShell engine, interpreter, and runtimecore PowerShell engine, interpreter, and runtime

Type

No type
No fields configured for issues without a type.

Projects

No projects

Relationships

None yet

Development

No branches or pull requests

Issue actions

    Morty Proxy This is a proxified and sanitized view of the page, visit original site.