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

PSNativeCommandPreserveBytePipe's performance issues #26101

Copy link
Copy link
@dt-flo

Description

@dt-flo
Issue body actions

Prerequisites

Steps to reproduce

Issue 1908 and pull request 17857 are about the feature PSNativeCommandPreserveBytePipe which introduces the ability to pipe binary data stream from one native application to another.

This feature works, however, I encounter significantly lower speeds when using PowerShell to chain two native applications in comparison to the speed when using other shells like Bash on Linux or cmd.exe on Windows.

To reproduce the issue, take any file, and use dd to read the file and pipe it to dd again to write it to the disk by using the command
dd if=inputfile bs=1MB | dd of=outputfile bs=1MB.

Expected behavior

dd should report the same speeds as if it was used in Bash or cmd.exe

Actual behavior

The speed is significantly reduced. The following tests are executed in an Ubuntu VM on an SSD drive.

Bash:

user@ubuntu:/tmp$ dd if=dotnet-sdk-9.0.305-win-x64.exe bs=1MB | dd of=dotnetout bs=1MB
226+1 records in
226+1 records out
226741024 bytes (227 MB, 216 MiB) copied, 0.988518 s, 229 MB/s
0+3588 records in
0+3588 records out
226741024 bytes (227 MB, 216 MiB) copied, 0.98907 s, 229 MB/s

PowerShell 7:

user@ubuntu:/tmp$ pwsh
PowerShell 7.5.3
PS /tmp> dd if=dotnet-sdk-9.0.305-win-x64.exe bs=1MB | dd of=dotnetout bs=1MB
226+1 records in
226+1 records out
226741024 bytes (227 MB, 216 MiB) copied, 1.68791 s, 134 MB/s
0+106333 records in
0+106333 records out
226741024 bytes (227 MB, 216 MiB) copied, 1.93509 s, 117 MB/s
PS /tmp>

In visuals, I have provided a screenshot of some tests I did in a freshly installed Debian 12 VM running in Hyper-V.
The drive was an NVMe SSD.

Error details

N/A

Environment data

PS > $PSVersionTable

Name                           Value
----                           -----
PSVersion                      7.5.3
PSEdition                      Core
GitCommitId                    7.5.3
OS                             Ubuntu 24.04.3 LTS
Platform                       Unix
PSCompatibleVersions           {1.0, 2.0, 3.0, 4.0…}
PSRemotingProtocolVersion      2.3
SerializationVersion           1.1.0.1
WSManStackVersion              3.0

PS >

Visuals

Image
Reactions are currently unavailable

Metadata

Metadata

Labels

KeepOpenThe bot will ignore these and not auto-closeThe bot will ignore these and not auto-closeWG-Engine-Performancecore PowerShell engine, interpreter, and runtime performancecore PowerShell engine, interpreter, and runtime performanceWG-ReviewedA Working Group has reviewed this and made a recommendationA Working Group has reviewed this and made a recommendation

Type

No type
No fields configured for issues without a type.

Projects

No projects

Milestone

No milestone

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.