This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
┌──count()─┐ | |
│ 11849659 │ | |
└──────────┘ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
using System.Buffers; | |
using BenchmarkDotNet.Attributes; | |
using BenchmarkDotNet.Running; | |
public class Program | |
{ | |
private static void Main(string[] args) | |
{ | |
var summary = BenchmarkRunner.Run<PoolBench>(); | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
using System; | |
BadMethod(1,2); | |
BadMethod(2,1); // bang! | |
GoodMethod(2,1); // tadam | |
var uid = (UserId)1; | |
var accid = (AccountId)2; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
using System; | |
using System.Collections.Concurrent; | |
using System.Diagnostics; | |
public static class Program | |
{ | |
public static Func<T, V> MemoizeExt<T, V>(this Func<T, V> f) => a => | |
new ConcurrentDictionary<T, V>().GetOrAdd(a, f); | |
public static Func<T, V> Memoize<T, V>(Func<T, V> f) => a => |