Switch DeleteTable
impl to one based on FixedBitSet
#2183
Merged
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Description of Changes
Fixes #2147.
Changes the implementation of
DeleteTable
to be based on grouping by page.To be more specific, each page (
PageIndex
) is assigned its ownFixedBitSet
, which tracks whichPageOffset
s, converted to indices usingfixed_row_size
, is contained.Based on micro benchmarks, this brings us to from about 172 ns per iteration (
BTreeSet<RowPointer>
), to about 40 ns.Using
FixedBitSet
performs better in all cases, includingcontains
,insert
,remove
,iter
. The only drawback is that it uses more space for small tables, but it should use significantly less space as the initial cost becomes negligible.The micro benchmarks are added in the PR, but no effort is made to test and document all the other implementations.
API and ABI breaking changes
None.
Expected complexity level and risk
2, not very complex, but it does touch the datastore.
However, the new code is well tested.
Testing
Proptests are added that assert that
DeleteTable
behaves correctly as a set, including by checking that it behaves observably asBTreeSet
.