BenchmarkDotNet icon indicating copy to clipboard operation
BenchmarkDotNet copied to clipboard

add `--justBuild` for users who want to reuse code produced by BDN without running the benchmarks

Open adamsitnik opened this issue 2 years ago • 3 comments

Sample:

dotnet run -c Release -f net5.0 --filter *Basic* --justBuild true
// start dotnet  build -c Release --no-restore /p:UseSharedCompilation=false /p:BuildInParallel=false /m:1 /p:Deterministic=true /p:Optimize=true in D:\projects\BenchmarkDotNet\samples\BenchmarkDotNet.Samples\bin\Release\net5.0\DefaultJob
Microsoft (R) Build Engine version 17.2.0-preview-22104-01+09bdfae16 for .NET
Copyright (C) Microsoft Corporation. All rights reserved.
  You are using a preview version of .NET. See: https://aka.ms/dotnet-support-policy
  BenchmarkDotNet.Disassembler.x64 -> D:\projects\BenchmarkDotNet\src\BenchmarkDotNet\Disassemblers\net461\win7-x64\BenchmarkDotNet.Disassembler.x64.exe
  BenchmarkDotNet.Disassembler.x86 -> D:\projects\BenchmarkDotNet\src\BenchmarkDotNet\Disassemblers\net461\win7-x86\BenchmarkDotNet.Disassembler.x86.exe
  BenchmarkDotNet.Annotations -> D:\projects\BenchmarkDotNet\src\BenchmarkDotNet.Annotations\bin\Release\netstandard2.0\BenchmarkDotNet.Annotations.dll
  BenchmarkDotNet -> D:\projects\BenchmarkDotNet\src\BenchmarkDotNet\bin\Release\netstandard2.0\BenchmarkDotNet.dll
  BenchmarkDotNet.Diagnostics.Windows -> D:\projects\BenchmarkDotNet\src\BenchmarkDotNet.Diagnostics.Windows\bin\Release\netstandard2.0\BenchmarkDotNet.Diagnostics.Windows.dll
  BenchmarkDotNet.Samples -> D:\projects\BenchmarkDotNet\samples\BenchmarkDotNet.Samples\bin\Release\net5.0\BenchmarkDotNet.Samples.dll
  BenchmarkDotNet.Autogenerated -> D:\projects\BenchmarkDotNet\samples\BenchmarkDotNet.Samples\bin\Release\net5.0\DefaultJob\bin\Release\net5.0\DefaultJob.dll
Build succeeded.
    0 Warning(s)
    0 Error(s)
Time Elapsed 00:00:02.17
// command took 2.39s and exited with 0
// ***** Done, took 00:00:03 (3.54 sec)   *****
// Found 2 benchmarks:
//   IntroBasic.Sleep: DefaultJob
//   IntroBasic.Thread.Sleep(10): DefaultJob

// The produced executable can be found at 'D:\projects\BenchmarkDotNet\samples\BenchmarkDotNet.Samples\bin\Release\net5.0\DefaultJob\bin\Release\net5.0\DefaultJob.dll'.

cc @Maoni0 @radical @AndyAyersMS

adamsitnik avatar Mar 21 '22 20:03 adamsitnik

what's the usage scenario for this? how do you reuse this code? I guess this is not meant to keep the dll that contains the benchmarks so it doesn't get deleted by default? ie, an alternative way of doing `--keepFiles true"?

Maoni0 avatar Mar 22 '22 01:03 Maoni0

what's the usage scenario for this? how do you reuse this code? I guess this is not meant to keep the dll that contains the benchmarks so it doesn't get deleted by default? ie, an alternative way of doing `--keepFiles true"?

The idea is that when you want to reuse the code produced by BDN to either debug or profile it, you just pass --justBuild and BDN builds the code, but does not run it. It just reports the path to the produced .dll/.exe, does not remove it and quits.

@Maoni0 is that going to be helpful?

adamsitnik avatar Mar 22 '22 08:03 adamsitnik

@Maoni0 is that going to be helpful?

I have no idea :) I use BDN so little that I'm not sure what I can do with the dll that gets built. without an end to end scenario it's hard to me to tell what's useful and what's not.

Maoni0 avatar Mar 22 '22 22:03 Maoni0