Skip to content

Instantly share code, notes, and snippets.

View benaadams's full-sized avatar
🦆
rubber duck debugging

Ben Adams benaadams

🦆
rubber duck debugging
View GitHub Profile
using BenchmarkDotNet.Attributes;
using BenchmarkDotNet.Running;
using System;
namespace delegate_interface
{
public class Program : IFoo
{
const int InnerLoopCount = 10000;
using System;
using System.Buffers;
using System.Runtime.CompilerServices;
using BenchmarkDotNet.Attributes;
using BenchmarkDotNet.Running;
public class Program
{
public static void Main(string[] args)
=> BenchmarkSwitcher.FromAssembly(typeof(Program).Assembly).Run(args);
@benaadams
benaadams / Enviorment
Last active December 9, 2018 04:08
PipeThroughputBenchmark
SET COMPlus_TieredCompilation=0
using BenchmarkDotNet.Attributes;
using BenchmarkDotNet.Running;
using System;
namespace hash
{
public class Program
{
const int Iterations = 10;
This file has been truncated, but you can view the full file.
****** START compiling <Task1>d__1:MoveNext():this (MethodHash=39840edc)
Generating code for Windows x64
OPTIONS: compCodeOpt = BLENDED_CODE
OPTIONS: compDbgCode = false
OPTIONS: compDbgInfo = true
OPTIONS: compDbgEnC = false
OPTIONS: compProcedureSplitting = false
OPTIONS: compProcedureSplittingEH = false
OPTIONS: Stack probing is DISABLED
This file has been truncated, but you can view the full file.
****** START compiling <ValueTask1>d__1:MoveNext():this (MethodHash=87def557)
Generating code for Windows x64
OPTIONS: compCodeOpt = BLENDED_CODE
OPTIONS: compDbgCode = false
OPTIONS: compDbgInfo = true
OPTIONS: compDbgEnC = false
OPTIONS: compProcedureSplitting = false
OPTIONS: compProcedureSplittingEH = false
OPTIONS: Stack probing is DISABLED
****** START compiling Program:ViaStruct5() (MethodHash=900a8869)
Generating code for Windows x64
OPTIONS: compCodeOpt = BLENDED_CODE
OPTIONS: compDbgCode = false
OPTIONS: compDbgInfo = true
OPTIONS: compDbgEnC = false
OPTIONS: compProcedureSplitting = false
OPTIONS: compProcedureSplittingEH = false
OPTIONS: Stack probing is DISABLED
IL to import:
@benaadams
benaadams / ValueLinqBenchmarks.cs
Created June 14, 2018 07:20
Value Linq Benchmarks
using BenchmarkDotNet.Attributes;
using BenchmarkDotNet.Attributes.Columns;
using BenchmarkDotNet.Configs;
using BenchmarkDotNet.Running;
using System;
using System.Collections;
using System.Collections.Generic;
using System.Linq;
using System.Runtime.CompilerServices;
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public int ReadByte()
{
if (this.position >= this.Length)
{
return -1;
}
if (this.position == 0 || this.bytesRead >= ChunkLength)
{
const int maxBuffer = 1024;
while (true)
{
var result = await application.Output.ReadAsync();
var buffer = result.Buffer;
// Check if we have enough to perform a write
if (buffer.Length >= maxBuffer)
{