Skip to content

Pool IPC serializer string buffers - #10141

Merged
Amaury Levé (Evangelink) merged 1 commit into
mainfrom
dev/amauryleve/pool-ipc-serializer-buffers
Jul 22, 2026
Merged

Amaury Levé (Evangelink) merged 1 commit into
mainfrom
dev/amauryleve/pool-ipc-serializer-buffers

Conversation

@Evangelink

Copy link
Copy Markdown
Member

Summary

  • rent temporary UTF-8 byte arrays from ArrayPool<byte>.Shared for IPC string reads and writes on NETCOREAPP
  • return rented buffers in finally blocks, including when stream operations fail
  • reuse ReadStringValue from the length-prefixed string reader and preserve the existing legacy-target fallback
  • size write buffers using the exact UTF-8 byte count to avoid oversized pool rentals

Validation

  • build.cmd -projects test\UnitTests\Microsoft.Testing.Platform.UnitTests\Microsoft.Testing.Platform.UnitTests.csproj -test -bl
  • passed on net8.0, net9.0, and net462 with 0 warnings and 0 errors

Fixes #10140

Rent temporary UTF-8 byte buffers on NETCOREAPP and return them in finally blocks, while retaining the existing fallback for legacy targets.

Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>

Copilot-Session: 7bf77553-6f59-4ee3-b2ea-092659c8d343
Copilot AI review requested due to automatic review settings July 22, 2026 14:46
@Evangelink
Amaury Levé (Evangelink) enabled auto-merge (squash) July 22, 2026 14:49

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Pools temporary UTF-8 buffers to reduce IPC serialization allocations while preserving legacy-target behavior.

Changes:

  • Reuses ReadStringValue for length-prefixed strings.
  • Rents precisely sized buffers and returns them in finally blocks.
  • Retains allocation-based fallback outside NETCOREAPP.
Show a summary per file
File Description
src/Platform/Microsoft.Testing.Platform/IPC/Serializers/BaseSerializer.cs Pools UTF-8 buffers for string serialization and deserialization.

Review details

  • Files reviewed: 1/1 changed files
  • Comments generated: 0
  • Review effort level: Medium

@Evangelink Amaury Levé (Evangelink) added the state/needs-review Awaiting review from the team. label Jul 22, 2026
@Evangelink
Amaury Levé (Evangelink) merged commit 9853925 into main Jul 22, 2026
28 checks passed
@Evangelink
Amaury Levé (Evangelink) deleted the dev/amauryleve/pool-ipc-serializer-buffers branch July 22, 2026 21:27
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

state/needs-review Awaiting review from the team.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[perf-improver] Pool byte arrays in IPC BaseSerializer string read/write

3 participants