haskell / haskell/containers

Deserializing maps and sets

Open
#405 19 comments 0 reactions 0 assignees View on GitHub
docs feature-request IntMap IntSet Map performance Set
Dominant language
Haskell
Stars
355
Forks
194
Avg merge
3d 4h
Merged PRs (30d)
4

Description

`binary`, `cereal` and `store` all deserialize `Set`s, `IntSet`s, `Map`s and `IntMap`s via `fromDistinctAscList <$> deserializeList` or even `fromList <$> deserializeList` and I've been wondering if that's the best way to do it.

The problem seems to be that this will first completely build the intermediary list before the map or set is constructed from the list.

Instead, it seems to me that the set or map should be built by repeatedly inserting a single element.

Do you agree that this should save a lot of memory allocations?

What I think is missing from `containers` to support the alternative deserialization implementations is something like a `insertDistinctMax` function that can efficiently insert an element that is known to be strictly greater than all elements in the set/map.

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.