usethesource / capsule

The Capsule Hash Trie Collections Library
BSD 2-Clause "Simplified" License
404 stars 28 forks source link

Backport insertion-ordered immutable map to capsule #5

Open msteindorfer opened 8 years ago

msteindorfer commented 8 years ago

I previously already implemented an insertion-ordered immutable map for another open-source project. The goal is to backport this implementation to capsule and integrate them into capsule's API.

wrandelshofer commented 2 years ago

Hi,

I made an experimental implementation of an insertion-ordered immutable map based on the CHAMP trie in Capsule. It stores elements with sequence numbers in the trie. Its iterators sort the elements with a bucket sort. It uses a large number of buckets (between N and N*4 buckets), so that the sorting can be performed in linear time.

I have benchmarked it against VectorMap in Scala. The performance is better, except for retrieval of the first/last element, which takes linear time in my implementation.

The code and benchmark results are here. https://github.com/wrandelshofer/vavr#readme

jurgenvinju commented 2 years ago

this is interesting! What kind of applications do you have in mind typically? Just to get an idea of what we could build on top of this.

wrandelshofer commented 2 years ago

Well, mostly the following kinds of applications:

jurgenvinju commented 2 years ago

👍 yes that sounds good. @msteindorfer do you have time to review @wrandelshofer 's branch? I think we might be able to use his contributions for Rascal as well. What do you think?