<xtree>: Consider encoding _Color and _Isnil in the least significant bits of a node pointer
Nobody has claimed this yet.
- Dominant language
- C++
- Stars
- 11.1k
- Forks
- 1.7k
- Avg merge
- 4d 15h
- Merged PRs (30d)
- 22
Description
map and set nodes are currently represented with:
This consumes a surprising amount of space. At first glance, _Color and _Isnil consume a total of 2 bytes, but because the node contains pointers, they actually consume a total of 4 bytes (for 32-bit architectures) or 8 bytes (for 64-bit architectures), due to alignment.
We could potentially encode these bits into one of the pointers, saving a significant amount of space, at the cost of additional bit-masking logic. (There are also "fancy pointers" to consider, but we could enable such an optimization for raw pointers only.)
Also tracked by Microsoft-internal VSO-854783 / AB#854783.
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
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start with the node representation in stl/inc/xtree around lines 321-330, then investigate how raw and fancy pointers affect layout and alignment. Any implementation must preserve the relevant pointer behavior while reducing node size, and cannot be proposed for acceptance until the vNext branch is available because it breaks binary compatibility.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- cpp
- Domain
- performance
- Issue type
- Feature
- Difficulty
- 5/5
- Estimated time
- Over a week
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 25/100