Enable validated async microbenchmarks on WASM - #5325
Merged
Merged
Conversation
Remove NoWasmValidator, which required every Task/ValueTask benchmark to be tagged NoWASM. BenchmarkDotNet now awaits async workloads, so returning an awaitable is no longer a reason to exclude a benchmark from WASM. Enable Perf_AsyncMethods, ValueTaskPerfTest, MemoryStreamTests.CopyToAsync and the MemoryStreamChunkedTests async benchmarks. Validated on Mono WASM (Node) and CoreCLR WASM (V8). Other async benchmarks keep their NoWASM tags. Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
LoopedBard3
approved these changes
Sep 28, 2026
LoopedBard3
left a comment
Member
There was a problem hiding this comment.
This looks great, thanks for the update!
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
WASM microbenchmark runs currently skip every benchmark that returns
Task/ValueTask.NoWasmValidatorenforced this by requiring every such benchmark to carryNoWASM. The pinned BenchmarkDotNet awaits async workloads, so returning an awaitable no longer needs to exclude a benchmark from WASM.Changes
NoWasmValidatorand its registration inProgram.cs.NoWASMfrom:Perf_AsyncMethods(class)ValueTaskPerfTest(class)MemoryStreamTests.CopyToAsyncMemoryStreamChunkedTests.ReadAsyncMemory,WriteAsyncMemory,CopyToAsyncWithBufferSizeNoWASMtags, e.g.Perf_Pipeand anything that relies on thread-pool concurrency.Perf_Pipeexclusion.docs/benchmarking-workflow-dotnet-runtime.md.Validation
Local runs (
scripts/benchmarks_ci.py --wasm, 1 iteration each) with SDK 11.0.100-rc.1.26425.128:--experimental-wasm-exnref): all enabled cases ran. This includes the ones that really yield:Yield,SingleYieldMethodInvocation,CreateAndAwait_FromYieldingAsyncMethod,CreateAndAwait_FromDelayedTCS.Trade-off
Without the validator, any new async benchmark runs on WASM unless it is explicitly tagged
NoWASM. Benchmarks that block synchronously or need multiple threads must be tagged by hand.Local tip: Mono and CoreCLR WASM runs share
artifacts/obj/BenchmarkDotNet.Autogenerated/Release/fx/. If you switch flavors on the same checkout, delete that folder first. Otherwise a stale Monodotnet.native.jscan end up in the CoreCLR publish and fail withdotnetInitializeModule is not a function.