Method | N | Mean | Error | StdDev | Gen 0 | Gen 1 | Gen 2 | Allocated |
---|---|---|---|---|---|---|---|---|
ObjectIdGenerator | 10 | 261.0 ns | 3.92 ns | 3.28 ns | 0.0176 | - | - | 280 B |
DictObjectIdGenerator | 10 | 415.4 ns | 7.92 ns | 8.81 ns | 0.0167 | - | - | 264 B |
ObjectIdGenerator | 100 | 2,237.4 ns | 38.87 ns | 32.45 ns | 0.0458 | - | - | 776 B |
DictObjectIdGenerator | 100 | 3,697.2 ns | 72.95 ns | 71.64 ns | 0.0648 | - | - | 1040 B |
ObjectIdGenerator | 1000 | 27,641.9 ns | 465.12 ns | 412.32 ns | 0.0916 | - | - | 1912 B |
DictObjectIdGenerator | 1000 | 35,959.2 ns |
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
namespace System.Collections.Generic | |
{ | |
class PriorityQueue<TElement, TPriority> : IReadOnlyCollection<(TElement Element, TPriority Priority)> | |
{ | |
#region Constructors | |
public PriorityQueue() { } | |
public PriorityQueue(IComparer<TPriority> comparer) { } | |
public PriorityQueue(IEnumerable<(TElement Element, TPriority Priority)> values) { } | |
public PriorityQueue(IEnumerable<(TElement Element, TPriority Priority)> values, IComparer<TPriority> comparer) { } | |
#endregion |
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
namespace Maybe | |
{ | |
public struct Maybe<T> | |
{ | |
public bool HasValue { get; } | |
public T Value { get; } | |
private Maybe(T value) | |
{ | |
HasValue = true; |
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.Threading.Tasks; | |
using BenchmarkDotNet.Attributes; | |
using BenchmarkDotNet.Running; | |
namespace ValueTaskBenchmarks | |
{ | |
// Uses the Ackermann function to measure performance of task and friends | |
// c.f. https://en.wikipedia.org/wiki/Ackermann_function |
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.Reflection; | |
using System.Runtime.CompilerServices; | |
using System.Runtime.ExceptionServices; | |
using System.Security; | |
using System.Threading.Tasks; | |
namespace ThunkBuilder | |
{ |
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.Threading; | |
using System.Threading.Tasks; | |
namespace Atom | |
{ | |
public class Atom<T> where T : class | |
{ | |
private T _value; |
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
[<RequireQualifiedAccess>] | |
module SlnTools | |
// Simple tool for generating Solution files out of a list of projects. | |
open System | |
open System.IO | |
open System.Text.RegularExpressions | |
let fsharpProjectTypeGuid = Guid.Parse "6EC3EE1D-3C4E-46DD-8F32-0CC8E7565705" |
I hereby claim:
- I am eiriktsarpalis on github.
- I am eiriktsarpalis (https://keybase.io/eiriktsarpalis) on keybase.
- I have a public key ASDsjo4ajiE7h4qGM_HbGrq2lco-Kj5LfRn2uCjZ2axtIQo
To claim this, I am signing this object:
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
// One of the common annoyances when writing imperative code in F# is that the | |
// expression-based nature of the language makes it effectively impossible to | |
// break or return in the midst of a for-loop. This is an attempt to encode | |
// lightweight cancellation on top of native for loops. As usual, this is intended | |
// as a PoC and should not be considered seriously for production code. | |
module Seq = | |
open System.Collections | |
open System.Collections.Generic |
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
#time "on" | |
open System | |
open System.Collections.Generic | |
let gdata = [|for i in 1 .. 1000000 -> Guid.NewGuid()|] | |
let sdata = gdata |> Array.map string | |
// Real: 00:00:17.774, CPU: 00:00:17.703, GC gen0: 378, gen1: 61, gen2: 1 | |
let gmap = ref Map.empty<Guid, int> |
NewerOlder