Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

CHAMP - Compressed Hash-Array Mapped Prefix Tree #49

Open
cloudRoutine opened this issue Nov 29, 2015 · 7 comments
Open

CHAMP - Compressed Hash-Array Mapped Prefix Tree #49

cloudRoutine opened this issue Nov 29, 2015 · 7 comments

Comments

@cloudRoutine
Copy link
Member

Possible addition to FSharpx.Collections?

Abstract
The data structures under-pinning collection API (e.g. lists, sets, maps) in the standard libraries of programming languages are used intensively in many applications.
The standard libraries of recent Java Virtual Machine languages, such as Clojure or Scala, contain scalable and well-performing immutable collection data structures that are implemented as Hash-Array Mapped Tries (HAMTs).HAMTs already feature efficient lookup, insert, and delete operations, however due to their tree-based nature their memory footprints and the runtime performance of iteration and equality checking lag behind array-based counterparts. This particularly prohibits their application in programs which process larger data sets.
In this paper, we propose changes to the HAMT design that increase the overall performance of immutable sets and maps. The resulting general purpose design increases cache locality and features a canonical representation. It outperforms Scala’s and Clojure’s data structure implementations in terms of memory footprint and runtime efficiency of iteration (1.3–6.7 x) and equality checking (3–25.4 x).

http://michael.steindorfer.name/publications/oopsla15.pdf

@forki
Copy link
Member

forki commented Nov 30, 2015

marking as up-for-grabs

@JeffHeon
Copy link

A ClojureScript implementation is in the work. Maybe it's helpful... or not :)

Lean Hash Array Mapped Trie implementation in ClojureScript

It will be presented at Clojure/west 2016 by Peter Schuck.

@rmunn
Copy link
Contributor

rmunn commented May 18, 2016

Peter Schuck's Clojure/west 2016 presentation is now on Youtube:

https://www.youtube.com/watch?v=GibNOQVelFY

@rmunn
Copy link
Contributor

rmunn commented Jun 1, 2017

The Java implementation of the CHAMP data structure, by Steindorfer and Vinju (the authors of the http://michael.steindorfer.name/publications/oopsla15.pdf paper):

https://github.com/usethesource/capsule

Another implementation, by someone else, in Kotlin: https://github.com/norswap/triemap

@simoncowen88
Copy link

Out of interest - do you really expect a CHAMP to perform particularly well in .NET?
My initial thought would be that due to the necessity of holding keys, values, and nodes in the same obj array the boxing / unboxing cost would be very high for non ref-type keys/values.

@rmunn
Copy link
Contributor

rmunn commented Aug 18, 2017

Particularly well? Not unless the boxing/unboxing problem you mention can be solved.

Better than the current PersistentHashMap? Absolutely; it suffers from the exact same boxing/unboxing issue for value types, so converting it to a CHAMP implementation should be a significant performance gain over the existing implementation.

@in-op
Copy link

in-op commented Jun 4, 2018

CHAMP conceptually splits each object[] into two sections, so it could actually use two arrays, one Node<T>[] and one T[]. This would prevent boxing/unboxing in exchange for the memory cost of having an extra array at each Node<T> (although it could be null if empty).

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

6 participants