Skip to content

Instantly share code, notes, and snippets.

@Tornhoof
Tornhoof / example.cs
Last active February 23, 2022 12:04
List Pattern Slice
https://devblogs.microsoft.com/dotnet/early-peek-at-csharp-11-features/#c-11-preview-list-patterns
// It's not middle, it's [1..^1], middle is only correct for 3 elements
// which could be assumed from https://github.com/dotnet/csharplang/blob/main/proposals/list-patterns.md because the examples
// simply do not include anything above 3 elements.
Console.WriteLine(CaptureSlice(new int[]{1,2,3}));
Console.WriteLine(CaptureSlice(new int[] { 1, 2, 3,4}));
Console.WriteLine(CaptureSlice(new int[] { 1, 2, 3, 4, 5 }));
Console.WriteLine(CaptureSlice(new int[] { 1, 2, 3, 4, 5, 6, 7, 8 }));
Console.ReadLine();
static string CaptureSlice(int[] values)
@Tornhoof
Tornhoof / SystemTextJsonBenchmarks.md
Created May 28, 2019 16:32
Benchmarks for System.Text.Json.JsonSerializer
BenchmarkDotNet=v0.11.5, OS=Windows 10.0.18362
Intel Core i9-9900K CPU 3.60GHz (Coffee Lake), 1 CPU, 16 logical and 8 physical cores
.NET Core SDK=3.0.100-preview6-012085
  [Host]     : .NET Core 3.0.0-preview6-27724-03 (CoreCLR 3.0.19.27471, CoreFX 4.700.19.27405), 64bit RyuJIT
  Job-HKNIHV : .NET Core 3.0.0-preview6-27724-03 (CoreCLR 3.0.19.27471, CoreFX 4.700.19.27405), 64bit RyuJIT

UnrollFactor=2  
@Tornhoof
Tornhoof / Benchmarks.md
Last active December 8, 2018 18:29
PBKDF2 Benchmarks
BenchmarkDotNet=v0.11.3, OS=Windows 10.0.17763.134 (1809/October2018Update/Redstone5)
Intel Core i9-9900K CPU 3.60GHz, 1 CPU, 16 logical and 8 physical cores
.NET Core SDK=2.2.100
  [Host]     : .NET Core 2.2.0 (CoreCLR 4.6.27110.04, CoreFX 4.6.27110.04), 64bit RyuJIT
  DefaultJob : .NET Core 2.2.0 (CoreCLR 4.6.27110.04, CoreFX 4.6.27110.04), 64bit RyuJIT
@Tornhoof
Tornhoof / Versions.md
Created November 12, 2018 18:45
NetCoreApp version vs. Asp.NET Core App Version
.NET Core SDK (gemäß "global.json"):
 Version:   2.1.403
 Commit:    04e15494b6

Laufzeitumgebung:
 OS Name:     Windows
 OS Version:  10.0.17763
 OS Platform: Windows
@Tornhoof
Tornhoof / IntegerJumpTable.cs
Created August 17, 2018 10:41
IntegerJumpTable
using System;
using System.Collections.Generic;
using System.Linq;
using System.Linq.Expressions;
using System.Reflection;
using System.Runtime.CompilerServices;
using System.Runtime.InteropServices;
using System.Text;
using System.Threading.Tasks;
@Tornhoof
Tornhoof / TieringDisabled.txt
Last active August 1, 2018 07:04
SpanJsonTieringBenchmarkLogs
// ***** BenchmarkRunner: Start *****
// Found benchmarks:
// SelectedBenchmarks.DeserializeAnswerWithSpanJsonSerializer: Job-TJIAIH(Toolchain=myget builds)
// SelectedBenchmarks.DeserializeAnswerWithSpanJsonSerializerUtf8: Job-TJIAIH(Toolchain=myget builds)
// SelectedBenchmarks.SerializeAnswerWithSpanJsonSerializer: Job-TJIAIH(Toolchain=myget builds)
// SelectedBenchmarks.SerializeAnswerWithSpanJsonSerializerUtf8: Job-TJIAIH(Toolchain=myget builds)
// Validating benchmarks:
// ***** Building 4 benchmark(s) in Parallel: Start *****
// ***** Done, took 00:00:11 (11.37 sec) *****
@Tornhoof
Tornhoof / stringcreate.cs
Created July 18, 2018 19:54
stringcreate
using System;
using System.Collections.Generic;
using System.Runtime.CompilerServices;
using System.Runtime.InteropServices;
using BenchmarkDotNet.Attributes;
using BenchmarkDotNet.Attributes.Jobs;
using BenchmarkDotNet.Running;
using Newtonsoft.Json;
namespace ConsoleApp34
using System;
using System.Collections.Generic;
using System.Linq;
using System.Net.Http;
using System.Net.NetworkInformation;
using System.Reflection;
using System.Threading.Tasks;
using Microsoft.AspNetCore;
using Microsoft.AspNetCore.Builder;
using Microsoft.AspNetCore.Connections.Features;
@Tornhoof
Tornhoof / DateTimeBenchmark
Created April 6, 2018 16:18
DateTime Formatting/Parsing
using System;
using System.Buffers.Text;
using System.Globalization;
using System.Text;
using BenchmarkDotNet.Attributes;
using BenchmarkDotNet.Running;
namespace FormatterBenchmark
{
internal class Program
@Tornhoof
Tornhoof / FormattingBenchmark.cs
Created April 6, 2018 14:57
Utf8Formatter vs CoreCLR
using System;
using System.Buffers.Text;
using System.Globalization;
using BenchmarkDotNet.Attributes;
using BenchmarkDotNet.Running;
namespace FormatterBenchmark
{
internal class Program
{