Commit c14e7c4
Update bdn 0.16 binarydata and async (#5217)
* Enable runtime-async for net11.0+
* Update BenchmarkDotNet to 0.16.0-nightly.20260518.1249
Bumps BenchmarkDotNet to the latest master nightly, built from
dotnet/BenchmarkDotNet@c7632225 ("Disassembly follow jump trampolines (#3136)")
and pushed to the benchmark-dotnet-prerelease internal feed.
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
* Migrate BenchmarkDotNet.Extensions to BDN 0.16.0 APIs
BDN 0.16.0 ('Async Refactor', PR #2958) made breaking API changes that
the harness still consumed:
- ExporterBase.ExportToLog(Summary, ILogger) was removed; the new abstract
ExportAsync uses an internal CancelableStreamWriter that subclasses can't
satisfy. PerfLabExporter now implements IExporter directly.
- IValidator.Validate returning IEnumerable<ValidationError> was replaced
with ValidateAsync returning IAsyncEnumerable<ValidationError>. The four
validators (UniqueArguments, TooManyTestCases, NoWasm, MandatoryCategory)
use .ToAsyncEnumerable() (transitively from BDN's
System.Linq.AsyncEnumerable dep), not async + yield return - the latter
produces an AsyncIteratorMethodBuilder state machine that deadlocks with
BDN's BenchmarkSynchronizationContext.
Switched BenchmarkDotNet.Extensions from netstandard2.0 to net8.0. The
netstandard2.0 target was only used to enable an opt-in net472 path, but
PERFLAB_TARGET_FRAMEWORKS=net472 is no longer exercised in CI and the new
BDN APIs would otherwise require polyfill packages. Removed the net472
package conditional from MicroBenchmarks.csproj and the net472/.NET
Framework references from docs/benchmarkdotnet.md and the micro README.
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
* Fix nullability errors surfaced by net8.0 retarget
Switching BenchmarkDotNet.Extensions from netstandard2.0 to net8.0
brought in stricter nullable annotations from the BCL and BDN package,
which combined with TreatWarningsAsErrors=true (set in
src/Directory.Build.props) turned previously-hidden nullability warnings
into build errors.
- ValuesGenerator.Dictionary<TKey, TValue>: add 'where TKey : notnull'
constraint required by Dictionary<,>.
- UniqueArgumentsValidator.BenchmarkArgumentsComparer.Equals: match the
IEqualityComparer<T>.Equals(T?, T?) interface signature; handle nulls.
- TooManyTestCasesValidator.SkipValidation: parameter must be MemberInfo?
since MemberInfo.DeclaringType returns Type?.
- DiffableDisassemblyExporter: add null-forgiving (!) on reflection
lookups whose return values are intentionally trusted by this type
(it's a copy of internal BDN code that operates on known types).
- PerfLabExporter: BuildJson can return null; use string?.
Verified by running the exact CI commands locally (dotnet restore +
build with --framework net11.0) using the SDK from global.json. Build
succeeds with 0 errors.
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
* Switch micro entrypoint to RunAsync to avoid discovery-time deadlock
BDN 0.16's sync entrypoints (BenchmarkSwitcher.Run / BenchmarkRunner.Run)
install BenchmarkDotNetSynchronizationContext (a single-threaded message
pump) before benchmark discovery. Discovery executes [ParamsSource] and
[ArgumentsSource] callbacks; some perf-repo callbacks do sync-over-async
(notably SslStreamTests.GetTls13Support, which calls HandshakeAsync(...)
.GetAwaiter().GetResult()). Sync-over-async deadlocks on the single-threaded
SyncCtx because the awaited continuation is queued back to a pump that the
caller is blocking.
Switch Program.Main to async Task<int> and await BenchmarkSwitcher.RunAsync.
The async entrypoint never installs BenchmarkDotNetSynchronizationContext
on the caller, so discovery runs on the default context and sync-over-async
in source callbacks no longer deadlocks. Real benchmark execution still
gets the SyncCtx semantics it needs because BDN installs it inside the
per-benchmark execute path, not on the entrypoint thread.
This is the supported BDN-recommended fix for the discovery-deadlock
symptom; no BDN code change is required.
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
* Gate runtime-async behind 'runtimeasync' experiment
PR #5195 enabled the runtime-async language feature unconditionally for
net11.0+ via `<Features>`. To avoid affecting baseline measurement runs,
gate it behind the existing experiment infrastructure so it only takes
effect in the dedicated experiment lane.
- src/Directory.Build.targets: only set `runtime-async=on` when the
`EnableRuntimeAsync` MSBuild property is `true` (in addition to the
existing TFM check).
- scripts/ci_setup.py: when `--experiment-name=runtimeasync` is passed,
emit `EnableRuntimeAsync=true` as an env var so MSBuild picks it up
as a property (matches the pattern used by the `jitoptrepeat` experiment).
Verified locally: BDN dry runs against the BinaryDataPayload tests
succeed both with and without the env var (18/18 benchmarks each).
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
---------
Co-authored-by: Andy Gocke <andy@commentout.net>
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>1 parent 3ffc1d0 commit c14e7c4
18 files changed
Lines changed: 125 additions & 66 deletions
File tree
- docs
- eng
- scripts
- src
- benchmarks/micro
- harness/BenchmarkDotNet.Extensions
- tests/harness/BenchmarkDotNet.Extensions.Tests
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
289 | 289 | | |
290 | 290 | | |
291 | 291 | | |
292 | | - | |
| 292 | + | |
293 | 293 | | |
294 | 294 | | |
295 | 295 | | |
| |||
361 | 361 | | |
362 | 362 | | |
363 | 363 | | |
364 | | - | |
365 | | - | |
366 | | - | |
367 | | - | |
368 | | - | |
369 | | - | |
370 | | - | |
371 | | - | |
372 | | - | |
373 | | - | |
374 | | - | |
375 | | - | |
376 | 364 | | |
377 | 365 | | |
378 | 366 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
11 | 11 | | |
12 | 12 | | |
13 | 13 | | |
14 | | - | |
| 14 | + | |
15 | 15 | | |
16 | 16 | | |
17 | 17 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
424 | 424 | | |
425 | 425 | | |
426 | 426 | | |
| 427 | + | |
| 428 | + | |
| 429 | + | |
| 430 | + | |
| 431 | + | |
427 | 432 | | |
428 | 433 | | |
429 | 434 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
5 | 5 | | |
6 | 6 | | |
7 | 7 | | |
8 | | - | |
| 8 | + | |
9 | 9 | | |
10 | 10 | | |
11 | | - | |
| 11 | + | |
12 | 12 | | |
13 | 13 | | |
14 | | - | |
| 14 | + | |
15 | 15 | | |
16 | 16 | | |
17 | 17 | | |
18 | 18 | | |
19 | 19 | | |
20 | 20 | | |
21 | | - | |
| 21 | + | |
22 | 22 | | |
23 | 23 | | |
24 | 24 | | |
25 | 25 | | |
26 | 26 | | |
27 | 27 | | |
28 | | - | |
| 28 | + | |
29 | 29 | | |
30 | 30 | | |
31 | 31 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
| 1 | + | |
| 2 | + | |
| 3 | + | |
| 4 | + | |
| 5 | + | |
| 6 | + | |
| 7 | + | |
| 8 | + | |
| 9 | + | |
| 10 | + | |
| 11 | + | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
122 | 122 | | |
123 | 123 | | |
124 | 124 | | |
125 | | - | |
126 | | - | |
127 | | - | |
128 | | - | |
129 | | - | |
130 | | - | |
131 | | - | |
132 | | - | |
133 | 125 | | |
134 | 126 | | |
135 | 127 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
5 | 5 | | |
6 | 6 | | |
7 | 7 | | |
| 8 | + | |
8 | 9 | | |
9 | 10 | | |
10 | 11 | | |
| |||
14 | 15 | | |
15 | 16 | | |
16 | 17 | | |
17 | | - | |
| 18 | + | |
18 | 19 | | |
19 | 20 | | |
20 | 21 | | |
| |||
40 | 41 | | |
41 | 42 | | |
42 | 43 | | |
43 | | - | |
| 44 | + | |
| 45 | + | |
| 46 | + | |
| 47 | + | |
| 48 | + | |
| 49 | + | |
44 | 50 | | |
45 | | - | |
| 51 | + | |
46 | 52 | | |
47 | 53 | | |
48 | 54 | | |
| |||
52 | 58 | | |
53 | 59 | | |
54 | 60 | | |
55 | | - | |
| 61 | + | |
| 62 | + | |
| 63 | + | |
56 | 64 | | |
57 | 65 | | |
58 | 66 | | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
12 | 12 | | |
13 | 13 | | |
14 | 14 | | |
15 | | - | |
| 15 | + | |
16 | 16 | | |
17 | 17 | | |
18 | 18 | | |
| |||
Lines changed: 6 additions & 2 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
1 | 1 | | |
2 | 2 | | |
3 | 3 | | |
4 | | - | |
| 4 | + | |
| 5 | + | |
| 6 | + | |
| 7 | + | |
| 8 | + | |
5 | 9 | | |
6 | 10 | | |
7 | 11 | | |
| |||
13 | 17 | | |
14 | 18 | | |
15 | 19 | | |
16 | | - | |
| 20 | + | |
17 | 21 | | |
18 | 22 | | |
19 | 23 | | |
| |||
Lines changed: 7 additions & 7 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
61 | 61 | | |
62 | 62 | | |
63 | 63 | | |
64 | | - | |
| 64 | + | |
65 | 65 | | |
66 | | - | |
| 66 | + | |
67 | 67 | | |
68 | | - | |
| 68 | + | |
69 | 69 | | |
70 | | - | |
| 70 | + | |
71 | 71 | | |
72 | 72 | | |
73 | 73 | | |
74 | 74 | | |
75 | 75 | | |
76 | | - | |
| 76 | + | |
77 | 77 | | |
78 | 78 | | |
79 | 79 | | |
80 | 80 | | |
81 | | - | |
| 81 | + | |
82 | 82 | | |
83 | | - | |
| 83 | + | |
84 | 84 | | |
85 | 85 | | |
86 | 86 | | |
| |||
0 commit comments