Conversation
e973208 to
2244617
Compare
|
|
||
| partial class RunnableEmitter | ||
| { | ||
| // TODO: update this to support runtime-async. |
There was a problem hiding this comment.
@VSadov Should we emit runtime-async methods for this? Is it supported already? If so, what's the pattern?
|
@copilot review |
This comment was marked as off-topic.
This comment was marked as off-topic.
|
I did the minimum changes required for proper async benchmarks, but I'm not sure if we want to take it further. We could make all interface methods async ( @stephentoub Can we get your input here? |
Input on what specifically? |
On the whole async API design. More specifically my previous comment about how much of the surface we should make async and whether it even makes sense to add cancelation token support. |
# Conflicts: # src/BenchmarkDotNet/BenchmarkDotNet.csproj # src/BenchmarkDotNet/Code/CodeGenerator.cs # src/BenchmarkDotNet/Code/DeclarationsProvider.cs # src/BenchmarkDotNet/Templates/BenchmarkProgram.txt
# Conflicts: # src/BenchmarkDotNet/Engines/EngineJitStage.cs # src/BenchmarkDotNet/Engines/EngineParameters.cs # src/BenchmarkDotNet/Helpers/AwaitHelper.cs # src/BenchmarkDotNet/Running/BenchmarkCase.cs # src/BenchmarkDotNet/Toolchains/Executor.cs # src/BenchmarkDotNet/Toolchains/InProcess/Emit/Implementation/ConsumableTypeInfo.cs # src/BenchmarkDotNet/Toolchains/InProcess/Emit/Implementation/Emitters/RunnableEmitter.cs # src/BenchmarkDotNet/Toolchains/InProcess/Emit/Implementation/Runnable/RunnableProgram.cs # src/BenchmarkDotNet/Toolchains/InProcess/Emit/Implementation/Runnable/RunnableReflectionHelpers.cs # src/BenchmarkDotNet/Toolchains/InProcess/NoEmit/InProcessNoEmitRunner.cs # tests/BenchmarkDotNet.Tests/Mocks/MockEngine.cs
7d8880a to
62d575f
Compare
Core changes:
BenchmarkRunner.RunAsync/BenchmarkSwitcher.Run*AsyncAPIs.IterationSetup/Cleanupnow support async methods.IClockis passed to theWorkloadActionNoUnrolletc. benchmark methods and they pass backClockSpan, instead of theEnginestarting and stopping the clock.Behavior changes:
await Task.Yield()continues on the current synchronization context if it exists, or the current task scheduler. Previously this meant it continued on a ThreadPool thread, now it means it will likely run on the same thread via the newBenchmarkSynchronizationContext. This should be benign.Breaking changes:
IEngineRunResults Run()changed toValueTask<RunResults> RunAsync()EngineParametersWorkloadActionNoUnrolletc. changed fromAction<long>toFunc<long, IClock, ValueTask<ClockSpan>>GlobalSetupActionetc. changed fromActiontoFunc<ValueTask>IExecutorExecuteResult Execute(ExecuteParameters executeParameters)changed toValueTask<ExecuteResult> ExecuteAsync(ExecuteParameters executeParameters)IDiagnoser,IToolchain,IValidatorIEnumerable<ValidationError> Validate(ValidationParameters validationParameters)changed toIAsyncEnumerable<ValidationError> ValidateAsync(ValidationParameters validationParameters);ExecutionValidatorandReturnValueValidatorthat call user code that could be async.Other Changes:
InProcessNoEmitToolchain[AsyncCallerType]allows users to override the type used in the async method that calls their benchmark method.InProcessNoEmitToolchain[AggressivelyOptimizeMethods]instructs the assembly weaver to applyAggressiveOptimizationto all methods in the annotated type and nested types.EngineJitStageReturnValueValidatoris now able to validate async results.Fixes #2442
Unblocks #1808