-
-
Notifications
You must be signed in to change notification settings - Fork 1k
Enables benchmarking betweeen different Nuget packages #922
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
# Conflicts: # src/BenchmarkDotNet/Toolchains/DotNetCli/DotNetCliBuilder.cs # src/BenchmarkDotNet/Toolchains/DotNetCli/DotNetCliCommandExecutor.cs # src/BenchmarkDotNet/Toolchains/DotNetCli/DotNetCliGenerator.cs # src/BenchmarkDotNet/Toolchains/Roslyn/Generator.cs
adamsitnik
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@Shazwazza great PR! Honestly I was afraid that this feature will require a lot of code changes but you made great reuse of existing components and wrote it in really simple and smart way! 👍
Before we merge it could you please:
- Simplify the
IntroNugetand add a simple doc page to our docs? You can take a look intodocs\articles\samplesfor examples. - Add at least one test? Could be sth like:
public class NugetReferenceTests : BenchmarkTestExecutor
{
public NugetReferenceTests(ITestOutputHelper output) : base(output) { }
[Fact]
public void UserCanSpecifyCustomNuGetPackageDependency()
{
var toolchain = RuntimeInformation.IsFullFramework
? CsProjClassicNetToolchain.Current.Value // this .NET toolchain will do the right thing, the default RoslynToolchain does not support it
: CsProjCoreToolchain.Current.Value;
var job = Job.Dry.With(toolchain).WithNuget("Newtonsoft.Json", "11.0.2");
var config = CreateSimpleConfig(job: job);
CanExecute<WithCallToNewtonsoft>(config);
}
public class WithCallToNewtonsoft
{
[Benchmark] public void CallNewton() { } // the code that you added to IntroNuget would be great
}
}… added but not multiple of the same name, fixes version validation for pre-releases
… to show that the RoslynToolchain doesn't support Nuget refs
|
@adamsitnik I've pushed a few more commits to address your review including a few tests, let me know if there's anything i've missed |
|
@Shazwazza thank you! great job! |
|
Whoohoo! awesome :) 🎉 |
|
Hi @adamsitnik , I was wondering if there's already a way in BDN to specify nuget package sources? Reason I'm asking is because perhaps the https://github.com/dotnet/BenchmarkDotNet/blob/master/src/BenchmarkDotNet/Jobs/NugetReference.cs can be extended to have a 'Source' property which is then used when calling the |
the only way is to use a if this is not enough for your scenario, a PR would be very welcomed as usual thanks! |
referenced issue: #290
Some notes on this PR:
CsProjCoreToolchain, I've added a coupleTODOnotes in theRoslyn/Generator.cssince I think it might be possible to use the roslyn toolchain for this but I think will require a bunch of manual nuget.exe work (?)IntroNugetsample. As per the notes mentioned above, this uses Reflection in the sample so that we don't need a direct reference to the Newtonsoft.Json, however if you think it would be more clear as far as sample code goes, I can add a direct reference to the minimum version tested of Newtsonsoft.Json to demonstrate how a benchmark project should be setup to test between different Nuget versions... just let me know.How to benchmark between Nuget versions
Ideally this is how it is done:
When each benchmark is run, it will add the correct nuget package dependency and build the project with that specific version and run the benchmarks against it.
This scenario will not work if API signatures have changed between versions. In those cases, different benchmark projects would need to be setup for the same API surface area and then the resulting reports could be combined.