microsoft / microsoft/STL

`<unordered_set>`, `<unordered_map>`: Optimize representation

Open
#2,721 0 comments 2 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

performance vNext
Dominant language
C++
Stars
11.1k
Forks
1.7k
Avg merge
4d 15h
Merged PRs (30d)
22

Description

Currently unordered_ use doubly-linked lists and provide iterators that can be decremented.

It is sufficient to provide forward iterators and use single linked list. This will save some memory and help to address #1036 to some extent. Also it will address DevCom-10035118

From https://github.com/microsoft/STL/issues/1036#issuecomment-661742697:

unordered_meow really shouldn't be backed by a doubly-linked list; it is required to be forward but not bidi, so it doesn't need sentinel nodes. We should be able to arrange its representation (including the bucket "map") to avoid allocating memory.

vNext note: Resolving this issue will require breaking binary compatibility. We won't be able to accept pull requests for this issue until the vNext branch is available. See #169 for more information.

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start by reading the discussion linked from #1036 and the vNext context in #169, then confirm the compatibility constraints before attempting work. Done means revisiting the representation of unordered_set and unordered_map to use forward iteration and reduce memory, while accounting for the noted binary-compatibility break.

Written by the indexing model from the issue text.

Assessment

Tech stack
cpp
Domain
tooling
Issue type
Refactor
Difficulty
5/5
Estimated time
Over a week
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
20/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.