Where communities thrive


  • Join over 1.5M+ people
  • Join over 100K+ communities
  • Free without limits
  • Create your own community
People
Repo info
Activity
  • 20:13
    kevinsalimi commented #1661
  • 10:21
    xoofx commented #1438
  • 10:20
    xoofx reopened #1438
  • 10:20
    xoofx commented #1520
  • Apr 18 19:14
    xoofx commented #1520
  • Apr 18 19:12
    xoofx commented #1438
  • Apr 18 19:11
    xoofx closed #1438
  • Apr 18 19:11
    xoofx commented #1520
  • Apr 16 17:18
    naricc commented #1689
  • Apr 16 17:18
    naricc opened #1689
  • Apr 15 18:41
    alex-jitbit edited #1688
  • Apr 15 18:38
    alex-jitbit edited #1688
  • Apr 15 18:36
    alex-jitbit opened #1688
  • Apr 13 10:23
    raffaeler commented #1616
  • Apr 13 10:17
    adamsitnik commented #1616
  • Apr 13 10:15
    adamsitnik commented #1687
  • Apr 12 14:33
    nicosijtsma opened #1687
  • Apr 12 13:29
    raffaeler commented #1616
  • Apr 08 12:57
    adamsitnik synchronize #1686
  • Apr 08 12:54
    adamsitnik reopened #1686
Johannes Rössel [yWorks]
@jroessel
@gpetrou Wouldn't a static initializer of any type that's used in benchmarks do the trick?
gpetrou
@gpetrou
@jroessel I assume you are talking about the code per class case? I will check that. But assuming that this will work, how can Cleanup happen once per class or assembly?
Ivan Kochurkin
@KvanTTT
Hi! Is it possible to export to csv raw nanoseconds 18 instead of formatted form like 0.0184 ms?
Reason: I'm comparing several runtimes and need in normalized benchmark time.
Adam Sitnik
@adamsitnik
hi @KvanTTT SummaryStyle is what you are looking for
var summaryStyle = new SummaryStyle
{
    PrintUnitsInHeader = true,
    PrintUnitsInContent = false,
    SizeUnit = SizeUnit.B,
    TimeUnit = TimeUnit.Nanosecond
};

config = config.With(summaryStyle);
Ivan Kochurkin
@KvanTTT
Yes, I've already found it, but thank you! :thumbsup:
Jason Bock
@JasonBock
Is there any way to run a project with benchmark tests where LangVersion is set to preview? I want to test some stuff I'm writing for .NET 5.0 and I need to use C# 9 features, but when I have preview in play, I get:
error MSB4086: A numeric comparison was attempted on "$(LangVersion)" that evaluates to "preview" instead of a number, in condition "'$(LangVersion)' == '' Or '$(LangVersion)' < '7.3'".
Jason Bock
@JasonBock
Nevermind....I set it to 9.0 and apparently that worked :)
sanjaysoni5657
@sanjaysoni5657
Can we use dependency injection setup same as we do in dotnet core project for Benchmark Test?
Daniel Hughes
@trampster
I've run into an issue trying to create benchmarks for a .NET 5 c# source generator. It appears that it doesn't accept the LangVersion being set to Preview, but this is currently required for c# source generators
It doesn't work if set to 9.0 like what worked for @JasonBock
Clinton Ingram
@saucecontrol
What does it do if you set it to 9.0? That's the correct solution
Daniel Hughes
@trampster
If I set it to 9.0 it doesn't compile because the Source Generator doesn't generate any source
Clinton Ingram
@saucecontrol
the roslyn build in the 5.0 RC1 SDK definitely recognizes langversion 9.0. are you compiling with an older VS version instead?
Daniel Hughes
@trampster
No I'm on linux
I'm running 5.0.100-rc.1.20452.10
I'm using vscode and running from the commandline
Daniel Hughes
@trampster
The Source Generator announcement says that it requires Preview: https://devblogs.microsoft.com/dotnet/introducing-c-source-generators/
Why do I need to use the Preview LangVersion to consume a Source Generator?
Although Source Generators are not technically a C# language feature, they are in preview. Rather than introduce a new setting just for Source Generators, we decided it would be easier to just use the existing switch that enables preview language features for the C# compiler.
Given that Preview features are things that could benefit most from benchmarking, it seems an odd choice to not support them.
Daniel Hughes
@trampster
Roslyn doesn't have any problems recognizing langversion 9.0, its just that langversion 9.0 doesn't seem to include Source Generators yet.
Clinton Ingram
@saucecontrol
That's very strange... At the time that announcement was made, Roslyn didn't recognize 9.0, only preview. I believe SDK preview 7 was the first to recognize 9.0, so I would have expected all 9.0 roslyn features to fall under that flag at that point
Daniel Hughes
@trampster
I've asked about it on the roslyn gitter, my guess is that Source Generators wasn't deemed ready in time for c# 9.0 so stayed in preview.
The .net 5 RC1 announcement didn't mention Source Generators, which I thought was strange at the time but could be that it has been delayed.
Clinton Ingram
@saucecontrol
ohhhhhh
you can probably set up an inproc benchmark then https://benchmarkdotnet.org/articles/samples/IntroInProcess.html
Martz
@Martz2804_twitter

hi all, I have a question regarding benchmarkdotnet setup, read the docs but I can't seem to find the solution for it. Maybe this isn't the right tool or I (plan to) use it wrong.

Say you have a library you want to perf test with FunctionA() which calls into a lot of code internal to the lib. You want to benchmark the perf of FunctionA() accross multiple versions of the library. Is there a way to automate this "version switching" with benchmarkdotnet? I can't seem to find it

Clinton Ingram
@saucecontrol
You can do it if the library is in a nuget package: https://benchmarkdotnet.org/articles/samples/IntroNuGet.html
TeBeCo
@tebeco
i think theres a sample about nuget and newtonsoft doing this exactly
oO faster
Clinton Ingram
@saucecontrol
lol
TeBeCo
@tebeco
^^
Martz
@Martz2804_twitter
I don't know how I missed this... thank you folks, for the quick answer :) seems to be what I'm after!
TeBeCo
@tebeco
perfect ;)
Lev Yastrebov
@LevYas
Hi all! I have a bunch of questions :) I asked the first to @AndreyAkinshin by email, but maybe it didn't reach the destination, so I'll duplicate it here.
  1. What is the correct way to pass relative paths to benchmarks? I have test data in files and I have to load them before benchmarks to use the data in benchmarks. I failed to find the answer in google, all examples I saw used hardcoded paths.
Lev Yastrebov
@LevYas
2 I tried to enable hardware counters for my benchmarks according to this article https://adamsitnik.com/Hardware-Counters-Diagnoser/
But in my case, I have no "Mispredict rate" column, and BranchMispredictions, LLCMisses, TotalCycles show me "-". What am I doing wrong?
I tried to check how well I align my data to cache lines and improve calculation performance by using data-oriented design and SoA approaches, but first I need some metrics to evaluate the progress. Maybe you have a piece of advice on what counters I should use.
Lev Yastrebov
@LevYas
My setup is:
BenchmarkDotNet=v0.12.1, OS=Windows 10.0.19041.630 (2004/?/20H1)
Intel Core i7-3630QM CPU 2.40GHz (Ivy Bridge), 1 CPU, 8 logical and 4 physical cores
.NET Core SDK=5.0.101
[Host] : .NET Core 5.0.1 (CoreCLR 5.0.120.57516, CoreFX 5.0.120.57516), X64 RyuJIT
DefaultJob : .NET Core 5.0.1 (CoreCLR 5.0.120.57516, CoreFX 5.0.120.57516), X64 RyuJIT
Lev Yastrebov
@LevYas
If somebody will answer me (I hope :)), please tag me, so I do not miss the answer.
Oleksii Mykhniak
@OleksiyMukhnyak_gitlab

hi, I have a problem with dotnet standard 2.1

command:
dotnet benchmark Test.dll --filter Class1

exception:
Unhandled Exception: System.Reflection.ReflectionTypeLoadException: Unable to load one or more of the requested types.
Could not load file or assembly 'netstandard, Version=2.1.0.0, Culture=neutral, PublicKeyToken=cc7b13ffcd2ddd51'. The system cannot find the file specified.
Could not load file or assembly 'netstandard, Version=2.1.0.0, Culture=neutral, PublicKeyToken=cc7b13ffcd2ddd51'. The system cannot find the file specified.
Could not load file or assembly 'netstandard, Version=2.1.0.0, Culture=neutral, PublicKeyToken=cc7b13ffcd2ddd51'. The system cannot find the file specified.
at System.Reflection.RuntimeModule.GetTypes(RuntimeModule module)
at System.Reflection.RuntimeModule.GetTypes()
at System.Reflection.Assembly.GetTypes()
at BenchmarkDotNet.Extensions.ReflectionExtensions.GetRunnableBenchmarks(Assembly assembly) in W:\Work\BenchmarkDotNet\src\BenchmarkDotNet\Extensions\ReflectionExtensions.cs:line 131
at BenchmarkDotNet.Running.TypeFilter.GetTypesWithRunnableBenchmarks(IEnumerable1 types, IEnumerable1 assemblies, ILogger logger) in W:\Work\BenchmarkDotNet\src\BenchmarkDotNet\Running\TypeFilter.cs:line 34
at BenchmarkDotNet.Running.BenchmarkSwitcher.RunWithDirtyAssemblyResolveHelper(String[] args, IConfig config) in W:\Work\BenchmarkDotNet\src\BenchmarkDotNet\Running\BenchmarkSwitcher.cs:line 92
at BenchmarkDotNet.Running.BenchmarkSwitcher.Run(String[] args, IConfig config) in W:\Work\BenchmarkDotNet\src\BenchmarkDotNet\Running\BenchmarkSwitcher.cs:line 67
at BenchmarkDotNet.Tool.Program.OnExecute() in W:\Work\BenchmarkDotNet\src\BenchmarkDotNet.Tool\Program.cs:line 44
--- End of stack trace from previous location where exception was thrown ---
at McMaster.Extensions.CommandLineUtils.Conventions.ExecuteMethodConvention.Invoke(MethodInfo method, Object instance, Object[] arguments)
at McMaster.Extensions.CommandLineUtils.Conventions.ExecuteMethodConvention.OnExecute(ConventionContext context)
at McMaster.Extensions.CommandLineUtils.Conventions.ExecuteMethodConvention.<>cDisplayClass0_0.<<Apply>b0>d.MoveNext()
--- End of stack trace from previous location where exception was thrown ---
at McMaster.Extensions.CommandLineUtils.CommandLineApplication.<>cDisplayClass138_0.<OnExecute>b0()
at BenchmarkDotNet.Tool.Program.Main(String[] args) in W:\Work\BenchmarkDotNet\src\BenchmarkDotNet.Tool\Program.cs:line 26

I'm using BenchmarkDotNet v0.12.1
Antoine Blanchet
@ablanchet

Hi ! I'm trying to run a benchmark on netcoreapp3.1, net48 and Mono using the same console app. I added the different target frameworks in my csproj and it works for both netcoreapp3.1 and net48 but I get compilation errors for mono. The only way I get mono to work is by isolating it in its own project targeting net48 only.

I'm trying to run the sample Md5VsSha256 in an otherwise empty project. Using benchmarkdotnet 0.12.1.

Am I missing something?

cryolithic
@cryolithic
Is it possible to deploy and run BDN compiled and without source?
I attempted to use the binaries generated from a run, but it pauses at Before Everything looking for instruction from the runner it seems
Clinton Ingram
@saucecontrol
I haven't tried it, but it might be possible if you're using the InProcess toolchain
Kristian Wedberg
@KristianWedberg
Hi! When calculating the value of my custom column (IColumn), how do I get the "Mean" running time for the current benchmark case (so that I can show a throughput value)?
Kristian Wedberg
@KristianWedberg
I figured it out: var nanoSeconds = summary.Reports.First(br => br.BenchmarkCase == benchmarkCase).ResultStatistics.Mean;
Kristian Wedberg
@KristianWedberg
How do I hide a default column in the Summary? How do I hide an 'ArgumentSource' column in the Summary (I only use it to pass extra data)?