You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
* using Channels for high performance sending queue
@@ -43,6 +44,7 @@ Representative BenchmarkDotNet results show meaningful improvements on typical s
43
44
* disabled trace logging: `28.72 ns / 64 B` to approximately `0 ns / 0 B`
44
45
* queued text request envelope: `31.54 ns / 24 B` to `29.65 ns / 0 B`
45
46
* stream-backed binary `ResponseMessage.ToString()` at 32 KB: `1.149 us / 32872 B` to `44.60 ns / 104 B`
47
+
* .NET Framework 4.8.1 client receive path, via the `netstandard2.0` asset: 1000 x 1024 B text messages in `1.062 ms / 2312.21 KB`
46
48
47
49
For very large text messages, the resulting `string` allocation dominates the receive cost, so the library focuses on avoiding unnecessary intermediate allocations and avoiding retention of oversized receive buffers after traffic spikes.
Copy file name to clipboardExpand all lines: benchmarks/README.md
+31-10Lines changed: 31 additions & 10 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -2,29 +2,37 @@
2
2
3
3
This folder contains BenchmarkDotNet benchmarks for allocation-sensitive Websocket.Client hot paths.
4
4
5
-
The latest representative run below was captured on Windows 11, AMD Ryzen 9 3900X, .NET SDK 10.0.201, running the benchmarks on .NET 10.0.5 with BenchmarkDotNet `ShortRun`.
5
+
The representative .NET 10 results below were captured on Windows 11, AMD Ryzen 9 3900X, .NET SDK 10.0.201, running the benchmarks on .NET 10.0.5 with BenchmarkDotNet `ShortRun`.
6
6
7
-
Run all benchmarks:
7
+
The .NET Framework results were captured on the same machine with .NET SDK 10.0.300, BenchmarkDotNet 0.15.8, and .NET Framework 4.8.1 through the benchmark project's `net472` target.
Results are written to `BenchmarkDotNet.Artifacts\results`.
24
32
25
33
## What The Benchmarks Cover
26
34
27
-
-`ReceiveBufferBenchmarks` compares the old per-message `RecyclableMemoryStream` receive path, PR #158's `ArrayBufferWriter<byte>` path, and the current pooled receive buffer.
35
+
-`ReceiveBufferBenchmarks` compares the old per-message `RecyclableMemoryStream` receive path, PR #158's `ArrayBufferWriter<byte>` path, and the current pooled receive buffer. This benchmark is .NET 10-only because the comparison uses `ArrayBufferWriter<byte>`.
28
36
-`TextSendEncodingBenchmarks` compares outgoing text encoding through `Encoding.GetBytes(string)` against encoding into an `ArrayPool<byte>` buffer.
29
37
-`ResponseMessageBenchmarks` measures the `ResponseMessage.ToString()` stream-copy fix.
30
38
-`ObservablePropertyBenchmarks` measures cached observable properties versus creating an `AsObservable()` wrapper on every access.
@@ -109,9 +117,22 @@ Use the Ratio and Allocated columns for the quick answer. Values below 1.00 in R
109
117
110
118
`ClientReceiveBenchmarks` measures the current public `WebsocketClient` receive flow using an in-memory scripted `WebSocket`. It is not a before/after benchmark; it is a package-level smoke benchmark for the real client path.
111
119
120
+
#### .NET 10.0
121
+
112
122
| Messages | Message size | Mean | Allocated |
113
123
| ---: | ---: | ---: | ---: |
114
124
| 100 | 64 B | 10.19 us | 25.42 KB |
115
125
| 100 | 1024 B | 25.09 us | 212.93 KB |
116
126
| 1000 | 64 B | 81.07 us | 201.21 KB |
117
127
| 1000 | 1024 B | 215.61 us | 2076.21 KB |
128
+
129
+
#### .NET Framework 4.8.1
130
+
131
+
The `net472` benchmark target consumes the library's `netstandard2.0` asset, so this measures the compatibility path used by full .NET Framework applications.
0 commit comments