-
Notifications
You must be signed in to change notification settings - Fork 184
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
Use N-bit lengths for VZV IndexN format types #5594
Conversation
af91f15
to
141ea8d
Compare
It's not super common that Index8 is big enough, but it is quite common that Len8 is big enough. I feel like Index8Len16 would be one of the most commonly used settings. |
@sffc we can expose it easily in a followup, yeah. I think Index16Len8 is definitely more useful than Index8 and we should consider looking at where we use Index8 now. |
6af8748
to
c7ccd1a
Compare
c7ccd1a
to
e337aed
Compare
7dd76b6
to
ce913ec
Compare
/// The error to show when unable to construct a vec | ||
#[doc(hidden)] | ||
const TOO_LARGE_ERROR: &'static str; | ||
|
||
/// Safety: must be sizeof(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.
Suggestion: Why not just use size_of::<Self>()
which is const?
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 found it makes the code easier to read but I'm open to that being a followup
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.
basically mem::size_of::<F::Index>
feels clunkier than F::Index::SIZE
in the situations it gets used in.
however in my next PR I'm removing METADATA_WIDTH and that may make the expressions simple enough that a sizeof won't be a big deal
It is impossible for an IndexN array to need more than a length integer of size N, anyway, the max index is always
>=
the length.Part of #5523
Builds on #5593
We could in theory just have a
VZVFormatCombo<Index, Len>
type that allows free selection, however I'm trying to keep this minimal. Overall the main use case for that is picking things like "a small array of ;argely-sized elements" and we could just expose Index16Len8 for that. I can see that being useful for things like #5580, though it also feels like a data microoptimization.The "total" lines in fingerprints.csv are interspersed in giant diffs, and this basically only gets a max of 2-6 byte wins per data, but the overall data size went down by 200KB. Not amazing, not terrible.