-
Notifications
You must be signed in to change notification settings - Fork 1.8k
Optimize immutable id tracker mapping #6023
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
7156e5a
to
16e88b9
Compare
let mut external_to_internal_num: Vec<(u64, PointOffsetType)> = Vec::new(); | ||
let mut external_to_internal_uuid: Vec<(Uuid, PointOffsetType)> = Vec::new(); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I consider overallocating here once better than having to reallocate a few times.
let mut external_to_internal_num: Vec<(u64, PointOffsetType)> = Vec::new(); | |
let mut external_to_internal_uuid: Vec<(Uuid, PointOffsetType)> = Vec::new(); | |
let mut external_to_internal_num: Vec<(u64, PointOffsetType)> = Vec::with_capacity(len); | |
let mut external_to_internal_uuid: Vec<(Uuid, PointOffsetType)> = Vec::with_capacity(len); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
my logic was that only one of them actually filled, so didn't want to allocate more memory on start than needed
deleted: BitVec, | ||
internal_to_external: CompressedInternalToExternal, | ||
external_to_internal: CompressedExternalToInternal, | ||
) -> Self { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We must enforce the size of deleted
here, since this structure does not support dynamically sized deleted
flags currently.
PointMappings
is an example of where the deleted flags can have a different size:
// It is possible that `deleted` can be longer or shorter than `internal_to_external`.
// - if `deleted` is longer, then extra bits should be set to `false` and ignored.
deleted: BitVec,
I'll add an explicit resize
for now to prevent that problem. We can do that since we own the types here.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
16e88b9
to
e330add
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
🙌 Nice!
I rebased onto #6022 after merging it and committed some review remarks.
e330add
to
cb93323
Compare
* clone PointMappings into CompressedPointMappings * fmt * compressed internal to external * implement compressed external to internal mapping * some autogenerated tests * fix test * Explicitly resize deleted flags, ensure length matches number of points * Review remarks --------- Co-authored-by: timvisee <tim@visee.me>
No description provided.