mawosoft / benchmarkdotnet Goto Github PK
View Code? Open in Web Editor NEWThis project forked from dotnet/benchmarkdotnet
Powerful .NET library for benchmarking
Home Page: https://benchmarkdotnet.org
License: MIT License
This project forked from dotnet/benchmarkdotnet
Powerful .NET library for benchmarking
Home Page: https://benchmarkdotnet.org
License: MIT License
See https://github.com/mawosoft/BenchmarkDotNet.Tests/tree/master/BDNParamDisposal
for parameter/argument creation and disposal in BDN host and in generated projects.
The generated code does not dispose the actually used parameters/arguments at all. Disposal occurs only while enumerating a ParamsSource
or ArgumentsSource
to skip to the current one and only for the ones skipped:
BenchmarkDotNet/src/BenchmarkDotNet/Parameters/SmartParamBuilder.cs
Lines 145 to 162 in a5176a7
BDN host only disposes benchmarks it actually runs and only after they all have been run:
BenchmarkDotNet/src/BenchmarkDotNet/Running/BenchmarkRunnerClean.cs
Lines 111 to 117 in 38b99b9
IDisposable
chain goes: BenchmarkRunInfo
-> BenchmarkCase
(s) -> ParameterInstances
-> ParameterInstance
(s) -> (Value as IDisposable)?
However, BenchmarkCase
(s) - and therefore ParameterInstance
(s) - have been already created early and have gone through filters and validators.
The problem is that ParameterInstance
(s) are constructed per method. Multiple job definitions share the same cached instances. Thus a filtered BenchmarkCase
cannot be disposed because it might share ParameterInstance
(s) with benchmarks that are about to be run.
ExecutionValidator
(Base
) has been written before introduction of Arguments and wasn't updated accordingly.ReturnValueValidator
was written later(?), but is based on ExecutionValidatorBase
=> no ArgumentsSupport.InProcessNoEmitToolchain.FillMembers()
which handles Params only.WorkloadMethod.Invoke()
with null
for arguments.Not sure if these validators are used anymore. They probably wouldn't have worked for our use case in XmlBenchmarks anyway due to lack of arguments equality (not sure about byte
array equality, but ParamWrapper currently is in the way, see mawosoft/Mawosoft.Extensions.BenchmarkDotNet#22).
BenchmarkDotNet/src/BenchmarkDotNet/Reports/Summary.cs
Lines 154 to 155 in 156fd69
A bit problematic since SummaryStyle can be null
which seems to mean SummaryStyle.Default.
Affects:
public static class BenchmarkConverter {
public static BenchmarkRunInfo MethodsToBenchmarks(Type containingType, MethodInfo[] benchmarkMethods, IConfig config = null) {}
}
public static class BenchmarkRunner {
public static Summary Run(Type type, MethodInfo[] methods, IConfig config = null) {}
}
MethodInfo
s belong to the given Type
and will convert the methods anyway.DisplayInfo
will be wrong because BDN combines the class name from Type
with the method name from MethodInfo
despite the latter having a different ReflectedType
(DeclaringType
can be different if base class).Runnable_0
etc classes are derived from the wrong type.MemoryDiagnoser: MetricColumn "Allocated" always shows Bytes if SummaryStyle.PrintUnitsInContent is false, regardless of calculated best SizeUnit.
Introduced in 854633f
BenchmarkDotNet/src/BenchmarkDotNet/Configs/ManualConfig.cs
Lines 199 to 216 in 156fd69
For Add() and Create() this is definitely a bug, however with Union() I'm not so sure. If localConfig was selected via LocalOnly, it might make sense to go back to Union for the resulting config???
Furthermore, Union() ALWAYS uses the UnionRule from localConfig.
BenchmarkDotNet/src/BenchmarkDotNet/Running/UserInteraction.cs
Lines 38 to 41 in d312edc
in SmartParameter.ToSourceCode():
Similar issue was fixed in SmartArgument.ToSourceCode():
-string cast = $"({Value.GetType().GetCorrectCSharpTypeName()})"; // it's an object so we need to cast it to the right type
+string cast = $"({parameterDefinitions[argumentIndex].ParameterType.GetCorrectCSharpTypeName()})"; // it's an object so we need to cast it to the right type
Would probably fix dotnet#2011
Almost all of these package refs are outdated:
BenchmarkDotNet/src/BenchmarkDotNet/BenchmarkDotNet.csproj
Lines 16 to 31 in d312edc
<ItemGroup>
<PackageReference Include="CommandLineParser" Version="2.8.0" />
<PackageReference Include="Iced" Version="1.14.0" />
<PackageReference Include="Microsoft.Diagnostics.Runtime" Version="2.0.226801" />
<PackageReference Include="Microsoft.DotNet.PlatformAbstractions" Version="3.1.6" />
<PackageReference Include="Microsoft.Win32.Registry" Version="5.0.0" />
<PackageReference Include="Perfolizer" Version="0.2.1" />
<PackageReference Include="System.Management" Version="5.0.0" />
<PackageReference Include="System.Reflection.Emit" Version="4.7.0" />
<PackageReference Include="System.Reflection.Emit.Lightweight" Version="4.7.0" />
<PackageReference Include="System.ValueTuple" Version="4.5.0" />
<PackageReference Include="System.Threading.Tasks.Extensions" Version="4.5.4" />
<PackageReference Include="Microsoft.CodeAnalysis.CSharp" Version="3.11.0" />
<PackageReference Include="Microsoft.Diagnostics.NETCore.Client" Version="0.2.236902" />
<PackageReference Include="Microsoft.Diagnostics.Tracing.TraceEvent" Version="2.0.71" PrivateAssets="contentfiles;analyzers" />
</ItemGroup>
Noticed this as BDN wasn't reporting VM infos with .NET core builds because System.Management.ManagementObjectSearcher
throws an exception that's silently eaten.
The outdated refs might cause some other side effects as well.
Don't know if they are kept for some backward compat.
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.