This is an alternative site for discovering Elm packages. You may be looking for the official Elm package site instead.
Alternative Dict implementation backed by an AVL tree.
version 1.2.2
license BSD3
native-modules False
elm-version 0.18.0 <= v < 0.19.0
Tag 1.2.2
Committed At 2017-03-19 19:03:53 UTC
elm-lang/core 5.1.1 <= v < 6.0.0 5.1.1

Modules

README

Alternative Dict implementation backed by AVL tree Build Status

Elevator pitch

Red-black trees as used in core's Dict require quite a few modifications for rebalancing. Worse; they require quite a few comparisons to do the correct modifications, which is notoriously slow in Elm. AVL trees offer similar worst-case performance characteristics, but in this case, much better insertion performance.

Performance

You can find a little write up on the benchmarks and the methodology on this page.

Using Dict.AVL

Dict.AVL has the exact same API as core Dict, so using it can be accomplished by simply doing something like this:

import Dict.AVL as Dict

There is one exception - checking for equality. Since core's Dict is special cased in elm ecosystem for equality checks, and we can't use this same special case due to a different internal structure, you'll need to use the Dict.AVL.eq function.

import Dict.AVL as Dict

left = Dict.fromList [(0, ()), (1, ())]
right = Dict.fromList [(1, ()), (0, ())]

-- This will return False
left == right

-- This works as expected and returns True
Dict.eq left right