F# PowerPack Site

Microsoft Research documentation from previous release


F# PowerPack, with F# Compiler Source Drops

The current best practice for installing the F# PowerPack Data Structures is to use the latest NuGet FSPowerPack.Core.Community. For a library that requires additional install procedures, the data structures have the unfortunate and confusing characteristic of identifying with the Microsoft.FSharp.Collections namespace, so no import declaration is required in your source code.

Microsoft Research Microsoft.FSharp.Collections

Microsoft Research Microsoft.FSharp.Collections.Tagged

PowerPack Performance Metrics


HashMultiMap Performance Metrics

Not Purely Functional

  1. AddOne Action performance beats new() performance up to scale 104. At higher scales performance between the two is roughly equal.
  2. Good AddOne Action scaling performance through scale 106. Much better than Map.

HashMultiMap Docs

Mutable hash sets based by default on F# structural “hash” and (=) functions. Implemented via a hash table and/or Dictionary. Be aware there may be multiple bindings for any given hash key.


new : unit -> HashMultiMap<'Key,'Value>
new : comparer:IEqualityComparer<'Key> * size:int -> HashMultiMap<'Key,'Value>
new : entries:seq<'Key * 'Value> -> HashMultiMap<'Key,'Value>
new : size:int -> HashMultiMap<'Key,'Value>


LazyList Performance Metrics

Purely Functional

  1. As would be expected good Init and AddOne Action performance through scale 106.
  2. At scale 106 Init Action significantly outperforms AddOne Action.

LazyList Docs

LazyLists are possibly-infinite, cached sequences. See also IEnumerable/Seq for uncached sequences. Calling “get” on the same lazy list value you will keep getting the same (cached) result. LazyLists normally involve delayed computations without side-effects, and calling “get” may cause these computations to be executed. The results of these computations are cached – evaluations will be performed only once for each element of the lazy list. This is different to IEnumerable/Seq where recomputation happens each time an enumerator is created and the sequence traversed. LazyLists can represent cached potentially-infinite computations. Because they are cached they may cause memory leaks if some part of your code maintains a live reference to the head of an infinite or very large lazy list while iterating it, or if a reference is maintained after the list is no longer required. Although lazy lists are an abstract type you may pattern match against them using the LazyList.Cons and LazyList.Nil active patterns. These may force the computation of elements of the list.

–from original Microsoft Research documentation


LazyList has no constructors. Instantiate a LazyList through one of the LazyList Module operators.

Leave a Reply

Your email address will not be published. Required fields are marked *

You may use these HTML tags and attributes: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong>