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
Replaced anonymous pipes with named pipe, and made IHost methods async for true async I/O.
|
@pavelsavara Can you sanity check the wasm changes here? Claude had the genius idea to use file-based IPC for JS shells that don't support WebSocket, so I was able to use that and still keep v8 as the default engine. (I don't expect a full review, this PR is too massive.) |
c5c0695 to
42d9dd7
Compare
Refactor AsyncProcessOutputReader to take separate stdErrLogger.
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:
IHostvoid Write(string message)CancellationToken CancellationToken { get; }andValueTask Yield()void SendSignal(HostSignal hostSignal)toValueTask SendSignalAsync(HostSignal hostSignal)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, CancellationToken cancellationToken)IGeneratorGenerateResult GenerateProject(BuildPartition buildPartition, ILogger logger, string rootArtifactsFolderPath)toValueTask<GenerateResult> GenerateProjectAsync(BuildPartition buildPartition, ILogger logger, string rootArtifactsFolderPath, CancellationToken cancellationToken)IBuilderBuildResult Build(GenerateResult generateResult, BuildPartition buildPartition, ILogger logger)toValueTask<BuildResult> BuildAsync(GenerateResult generateResult, BuildPartition buildPartition, ILogger logger, CancellationToken cancellationToken)IDiagnoservoid Handle(HostSignal signal, DiagnoserActionParameters parameters)toValueTask HandleAsync(HostSignal signal, DiagnoserActionParameters parameters, CancellationToken cancellationToken)IDiagnoser,IToolchain,IValidatorIEnumerable<ValidationError> Validate(ValidationParameters validationParameters)toIAsyncEnumerable<ValidationError> ValidateAsync(ValidationParameters validationParameters);IExporterExportToLogandExportToFilesValueTask ExportAsync(Summary summary, ILogger logger, CancellationToken cancellationToken)Other Changes:
InProcessNoEmitToolchain[AsyncCallerType]allows users to override the type used in the async method that calls their benchmark method.InProcessNoEmitToolchain[BenchmarkCancellation]allows benchmarks to respond to cancellation requests from the user.[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
Fixes #2159
Fixes #2299
Fixes #2162
Unblocks #1808