TaskAndValueTask: retarget net10.0, bump packages, add Task/ValueTask conversion test - #2128
Open
vladimir-pecanac-main wants to merge 1 commit into
Conversation
… conversion test Retarget all three projects from net7.0 to net10.0. Bump BenchmarkDotNet 0.13.2 -> 0.15.8 and the test packages (Microsoft.NET.Test.Sdk 17.3.2 -> 18.9.0, xunit 2.4.2 -> 2.9.3, xunit.runner.visualstudio 2.4.5 -> 2.8.2, coverlet.collector 3.1.2 -> 10.0.1), which also clears the NU1903 advisory the old xunit runner pulled in through Newtonsoft.Json 9.0.1. Add ConversionTests, covering both directions between Task<T> and ValueTask<T>: the ValueTask<T>(Task<T>) and ValueTask<T>(TResult) constructors and AsTask(). Give both benchmark methods the same city argument. TaskBenchmark ran on "Denver" and ValueTaskBenchmark on "London", so the two rows differed in their input as well as their return type; with one city they differ only in what is being measured.
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.
Retargets the
TaskAndValueTasksample tonet10.0and adds the missing conversion direction, for the republished article Task vs ValueTask in C#: When to Use Each.net7.0tonet10.0.0.13.2->0.15.8;Microsoft.NET.Test.Sdk17.3.2->18.9.0,xunit2.4.2->2.9.3,xunit.runner.visualstudio2.4.5->2.8.2,coverlet.collector3.1.2->10.0.1. This also clears theNU1903advisory the old xunit runner pulled in throughNewtonsoft.Json9.0.1; the build is now warning-free.ConversionTestscovering both directions betweenTask<T>andValueTask<T>(new ValueTask<int>(Task<int>),new ValueTask<int>(int),.AsTask()). The article previously showed onlyAsTask().cityargument.TaskBenchmarkran on"Denver"andValueTaskBenchmarkon"London", so the two rows differed in their input as well as their return type.Verified locally on SDK 10.0.302 / runtime 10.0.10: build 0 errors 0 warnings,
dotnet test6/6 passed, benchmark re-run (85.36 ns / 144 B forTask, 60.61 ns / 0 B forValueTask).