Skip to content

Instantly share code, notes, and snippets.

PS C:\Users\igors\Documents\visual studio 2015\Projects\ConsoleApplication2\packages> dir
Каталог: C:\Users\igors\Documents\visual studio 2015\Projects\ConsoleApplication2\packages
Mode LastWriteTime Length Name
---- ------------- ------ ----
d----- 07.07.2016 11:09 BenchmarkDotNet.0.9.8
d----- 07.07.2016 11:09 Microsoft.CodeAnalysis.Analyzers.1.1.0
BenchmarkDotNet=v0.9.7.0
OS=Microsoft Windows NT 6.3.9600.0
Processor=Intel(R) Xeon(R) CPU 2.60GHz, ProcessorCount=1
Frequency=10000000 ticks, Resolution=100.0000 ns, Timer=UNKNOWN
HostCLR=MS.NET 4.0.30319.42000, Arch=64-bit RELEASE [RyuJIT]
JitModules=clrjit-v4.6.1055.0
Type=SimplePerfTest Mode=SingleRun Toolchain=InProcessToolchain
LaunchCount=1 WarmupCount=200 TargetCount=500
Test Name: CompetitionHighAccuracyBenchmark
Test Outcome: Passed
Result StandardOutput:
// !====================================
// !Run 1, total runs (expected): 1.
// ? #1.1 00,975s, Informational@Analyser: CompetitionAnalyser: All competition limits are ok.
========================================
BenchmarkDotNet=v0.9.7.0
class Program
{
static void Main(string[] args)
{
var config = new ManualConfig();
config.Add(DefaultConfig.Instance);
config.Add(new MemoryDiagnoser());
BenchmarkRunner.Run<SimpleBenchmark>(config);
}
}
using System;
using System.Diagnostics;
namespace CodeDrafts
{
static class Program
{
struct A
{
public uint a1;
using System;
using System.Diagnostics;
namespace CodeDrafts
{
static class Program
{
struct A
{
public uint a1;

CodeAssertions

Intro

What it is?

Code assertions is a set of helper methods aimed to proof your assumptions at runtime.

When should I use it?

Every time you want to be sure your code is working right.

using System;
using System.Diagnostics;
using System.Runtime.CompilerServices;
namespace System.Runtime.CompilerServices
{
#pragma warning disable 1591
// ReSharper disable ArrangeTypeModifiers
public static class FormattableStringFactory

// * Summary * BenchmarkDotNet-Dev=v0.9.3.0+ OS=Microsoft Windows NT 6.2.9200.0 Processor=Intel(R) Core(TM) i5-2550K CPU @ 3.40GHz, ProcessorCount=4 Frequency=3312788 ticks, Resolution=301.8605 ns HostCLR=MS.NET 4.0.30319.42000, Arch=32-bit RELEASE

Type=CompareCallsBenchmark Mode=Throughput TargetCount=10

Method | Median | StdDev | Scaled |

using System;
using System.Collections.Generic;
using System.Linq;
using System.Threading;
using BenchmarkDotNet.Attributes;
using BenchmarkDotNet.Configs;
using BenchmarkDotNet.Jobs;
using BenchmarkDotNet.Reports;
using BenchmarkDotNet.Running;
using NUnit.Framework;