-
Notifications
You must be signed in to change notification settings - Fork 472
Row changes #1787
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
Row changes #1787
Conversation
/// Number of bytes required by the datum. | ||
/// | ||
/// This is used to optimistically pre-allocate buffers for packing rows. | ||
pub fn datum_size(datum: &Datum) -> usize { |
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'm not very happy with where this is at the moment. Because the row
mod is private it can't be repr::row::datum_size()
, and repr::datum_size()
doesn't communicate what it is about. It could be a Row::datum_size()
method?
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 could just make row
public. As long as only the safe fns are public, should still be fine.
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.
Could also be Datum::packed_size
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.
Going to punt on this for the moment. @benesch indicates we might de-flatten repr
at which point making it be a method in row
would be great!
pub struct Row { | ||
data: Box<[u8]>, | ||
} | ||
|
||
/// These implementations order first by length, and then by slice contents. | ||
/// This allows many comparisons to complete without dereferencing memory. |
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.
This is devious. I like it.
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 should do it for Eq/PartialEq too.
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 hoped they were, but maybe they aren't. As in, I hoped Rust would be bright enough to check length equality first and then go for the contents. I'll look into it.
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.
Left a lot of little comments but the overall thrust is indeed uncontroversial :)
Minor changes to
Row
intended to uncontroversially improve things.