This is an alternative site for discovering Elm packages. You may be looking for the official Elm package site instead.
Drop-in replacement for Dict using AVL trees. Faster get, slower insert.
version 1.0.0
license BSD3
native-modules False
elm-version 0.18.0 <= v < 0.19.0
Tag 1.0.0
Committed At 2017-02-24 20:57:37 UTC
elm-lang/core 5.1.1 <= v < 6.0.0 5.1.1

Modules

README

Elm AVL Exploration Build Status

A drop-in reimplementation of Elm's Dict using AVL trees instead of red-black trees.

Quick Start

  1. elm package install BrianHicks/elm-avl-exploration
  2. import Dict.Avl as Dict wherever you want to use AVL Dicts

Why?

I wrote the original implementation for a blog series on functional data structures. After I was done, I wondered how my implementation compared to core, speed-wise.

Short answer: it's about 30% faster for reads, but 30% slower for inserts. If you know that you do a lot more reading than you do writing, especially on a small number of keys, this library will probably be faster than core.

Data from my machine is below. You can replicate by building benchmark/Main.elm and visiting the result in your browser.

WARNING: Treat these figures as hypothetical. You can and should use BrianHicks/elm-benchmark to verify these results in your own project with your own sample data.

get

Dict.Avl.get is about 30% faster than Dict.get, on average.

get performance

toList

Dict.Avl.toList is about 10% faster than Dict.toList, on average. toList is implemented using foldl, which may be an indicator of performance there. This advantage is mainly found on sets of 10 or fewer items.

toList performance

insert

Dict.Avl.insert is about 35% slower than Dict.insert, on average. This disadvantage is mainly found on sets of 10 or more items.

insert performance

remove

Dict.Avl.remove is about 25% faster than Dict.insert, on average. This advantage is mainly found on sets of 10 or fewer items.

remove performance

License

Elm AVL exploration is licensed under a 3-Clause BSD License, located at LICENSE.