-
-
Notifications
You must be signed in to change notification settings - Fork 14.7k
Use BTreeMap with u128 values for sparse bit sets/"vectors" (in dataflow etc.). #47575
Copy link
Copy link
Closed
Closed
Copy link
Labels
A-collectionsArea: `std::collections`Area: `std::collections`C-enhancementCategory: An issue proposing an enhancement or a PR with one.Category: An issue proposing an enhancement or a PR with one.I-compilememIssue: Problems and improvements with respect to memory usage during compilation.Issue: Problems and improvements with respect to memory usage during compilation.I-compiletimeIssue: Problems and improvements with respect to compile times.Issue: Problems and improvements with respect to compile times.T-compilerRelevant to the compiler team, which will review and decide on the PR/issue.Relevant to the compiler team, which will review and decide on the PR/issue.
Metadata
Metadata
Assignees
Labels
A-collectionsArea: `std::collections`Area: `std::collections`C-enhancementCategory: An issue proposing an enhancement or a PR with one.Category: An issue proposing an enhancement or a PR with one.I-compilememIssue: Problems and improvements with respect to memory usage during compilation.Issue: Problems and improvements with respect to memory usage during compilation.I-compiletimeIssue: Problems and improvements with respect to compile times.Issue: Problems and improvements with respect to compile times.T-compilerRelevant to the compiler team, which will review and decide on the PR/issue.Relevant to the compiler team, which will review and decide on the PR/issue.
Type
Fields
Give feedbackNo fields configured for issues without a type.
According to our current implementation of B-trees:
rust/src/liballoc/btree/node.rs
Lines 53 to 55 in 5965b79
it would appear that up to
11key-value pairs can be stored in each node.For
u128values representing128set elements each,1408set elements can be stored in a single allocation, with an overhead of around 50% compared toVec<u128>in the dense case.Such sparse bitsets would be really useful for (e.g. dataflow) analysis algorithms, in situations where the bitset elements tend to be localized, with multi-"word" gaps in between local groups.
cc @nikomatsakis @pnkfelix