Skip to content

Instantly share code, notes, and snippets.

cloudRoutine /
Created Dec 18, 2018 — forked from mrange/
F# Advent 2016 (English) - December 10 - Implementing a persistent hash map.
cloudRoutine /
Created Oct 12, 2016 — forked from mrange/
Optimizing a simple problem in F# and C++

Optimizing a simple problem

I was introduced to a simple optimization problem by one of my interns last week. He was about to participate in a friendly competition where they were asked to find a performant solution to the problem:

The problem

View countby performance.fsx
open System.Diagnostics
open System.Reflection
open Microsoft.FSharp.Core
open Microsoft.FSharp.Core.Operators
open Microsoft.FSharp.Core.LanguagePrimitives
open Microsoft.FSharp.Core.LanguagePrimitives.IntrinsicOperators
open Microsoft.FSharp.Collections
open Microsoft.FSharp.Primitives.Basics
open System.Collections.Generic
View TryGetExt.fsx
type ExtensionMethods() =
static member inline GetOption< ^a,'k,'v when 'a : (member TryGetValue : 'k * ('v byref) -> bool)>(this : ^a, key : 'k) =
let mutable v = Unchecked.defaultof<'v>
let scc = ( ^a : (member TryGetValue : 'k * ('v byref) -> bool) this, key, &v)
if scc then
Some v
View ndc-london-recordings.txt
Capability Red - Requirements at Scale by Liz Keogh
Beyond Rectangles in Web Design - CSS Shapes and CSS Masking by Razvan Caliman
Coding Culture by Sven Peters
The Ultimate Logging Architecture - You KNOW You Want It by Michele Leroux Bustamante