View BenchLinearVsBinary.cs
/*
Q: At which size is it preferrable to use binary search over a simple linear search for a small ordered set?
R: Under 5 elements, linear search is slightly faster (from 200% to 10% faster)
But in practice, not sure a switch case to select the best method is really worth it
Unless main usecase is having most of the time only 1-2 elements (so it could be optimized manually without a loop and switch to binary otherwise)
At 3-4 elements, linear is only 10-5% faster
Relative performance between linear and binary search:
size x86 x64
View ContinueWithAllocations.cs
[Config(typeof(Config))]
public class ContinueWithAllocations
{
private class Config : ManualConfig
{
public Config()
{
Add(new MemoryDiagnoser());
}
}
View clrmd-sdd-demo.cs
using Microsoft.Diagnostics.Runtime;
using System;
using System.Collections.Generic;
using System.Diagnostics;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace SDDTriage
{
View GuidCtorBenchmark.cs
// From https://twitter.com/aarnott/status/701653964823990273
public class Framework_Guid
{
[Benchmark(Baseline = true)]
public Guid CtorWithHexValues()
{
// creates a Guid that corresponds to "12345678-000b-000c-0001-020304050607".
return new Guid(0x12345678, 0xb, 0xc, 0, 1, 2, 3, 4, 5, 6, 7);
}
View Interpolated_vs_ToString.md
// Inspired by https://twitter.com/Nick_Craver/status/702693060472414208
public class Framework_Interpolated_vs_ToString
{
	private long counter = 0;

	[Setup]
	public void Setup()
	{
		counter = 0;
View SampleBenchmarkDotNetLog.txt
// ***** BenchmarkRunner: Start *****
// Found benchmarks:
// IntroBasic_SleepWithDescription
// IntroBasic_Sleep
// **************************
// Benchmark: IntroBasic_SleepWithDescription
// *** Generate ***
// Result = Success
// DirectoryPath = C:\__GitHub__\BenchmarkDotNet\BenchmarkDotNet.Samples\bin\Release\IntroBasic_SleepWithDescription
View Sample BenchmarkDotNet Benchmark.md

From this Benchmark code:

[Benchmark]
public Dictionary<string, string> DictionaryEnumeration()
{
	// Doesn't allocate
	foreach (var item in dict)
	{
		;
	}
View Explanation.md

As per the spec:

  • The command letter can be eliminated on subsequent commands if the same command is used multiple times in a row (e.g., you can drop the second "L" in "M 100 200 L 200 100 L -100 -200" and use "M 100 200 L 200 100 -100 -200" instead).

Original SVG - 4.93 KB (5,049 bytes)

<svg version="1.1" baseProfile="full" width="500" height="50" xmlns="http://www.w3.org/2000/svg" preserveAspectRatio="none">
  <line x1="0" y1="50" x2="500" y2="50" stroke="#f6f6f6" stroke-width="1" />
  <g fill="#008cba" stroke="none">
    <path d="M0 50 L0 41.7 L1 41.5 L2 42.2 L3 43.5 L4 44.3 L5 44.7 L6 45.2 L7 43.5 L8 44.3 L9 42.7 L10 42.3 L11 43.5 L12 44.5 L13 44.3 L14 44.3 L15 42.7 L16 43.0 L17 41.3 L18 40.8 L19 40.3 L20 41.8 L21 41.3 L22 42.8 L23 44.0 L24 42.7 L25 43.2 L26 43.8 L27 44.5 L28 43.2 L29 42.8 L30 44.0 L31 44.2 L32 43.3 L33 42.0 L34 42.5 L35 41.0 L36 39.5 L37 40.0 L38 40.5 L39 41.0 L40 40.7 L41 41.2 L42 41.7 L43 40.0 L44 41.0 L45 41.7 L46 41.0 L47 4
View ImmutabilityBenchmarks.cs
using BenchmarkDotNet;
using BenchmarkDotNet.Attributes;
using BenchmarkDotNet.Running;
using System.Collections.Generic;
using System.Collections.Immutable;
namespace ImmutabilityBenchmark
{
//[Config(processCount: 1, warmupIterationCount: 1, targetIterationCount: 1)]
public class BenchmarkProgram
View ObjectPool.cs
public interface IObjectPool<T>
{
T Rent();
void Return(T obj);
}
public interface IResetable
{
void Reset();
}