-
Notifications
You must be signed in to change notification settings - Fork 176
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
Add payload conversion and heap measurement tool #1670
Conversation
cc @robertbastian btw |
.help("Load input data from the icu_testdata project."), | ||
) | ||
.arg( | ||
Arg::with_name("KEYS") |
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 added this because I found it useful to be --keys specifickey -v
to debug things
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.
Also add ALL_KEYS
?
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.
There's currently no difference and we can add that as needed I think
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.
The difference with ALL_KEYS
over TEST_KEYS
is that in line 220 we wouldn't ignore key errors.
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.
That means all-keys would always error, datagen doesn't have proper support for this either. I'm only adding features that'll actually be useful.
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.
Overall I don't want this to just duplicate that other set of flags until we need those features
78b3eac
to
1883b45
Compare
Notice: the branch changed across the force-push!
~ Your Friendly Jira-GitHub PR Checker Bot |
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.
First batch; more in the morning
/// A blanket-implemented trait that allows for all the datagen-relevant traits | ||
/// to be used in trait objects. The type parameter is the marker type needed for | ||
/// [`IterableDynProvider`]. | ||
pub trait OmnibusDatagenProvider<M: DataMarker>: |
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.
Can we just call this DatagenProvider
?
Actually in #1092 we said that IterableDynProvider
is not the right trait for runtime, so maybe we can just rename that DatagenProvider
and make it extend the DataConverter
impls? It should also be behind the datagen
feature now that that exists.
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'd rather do wider refactors around what's under what feature as a result of #1320 (which I plan to get done soon)
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.
Still, what do buses have to do with this
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.
"Omnibus" is just a term used in English to talk about things that contain more things than usual, typically in the case of media around anthologies and "3-in-1 books".
In this case, this is really just "a lot of traits in one trait", hence the trait name.
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 have never seen it used that way, maybe it's an American thing. I'd prefer if we avoid such words, we should keep our code accessible to non-Americans and non-native English speakers.
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.
Ah, gotcha. It is convenient to be able to have the list of all sub-providers in one place though
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.
(perhaps we could have that list be in the datagen crate)
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.
(perhaps we could have that list be in the datagen crate)
This would be fine with me. Alternatively: #1684
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.
That is a cool solution, can you incorporate #1684 ?
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.
It's not sufficient in and of itself without further work: you either need to name the really complex type over the boundary or you need to do a bunch of manual passthrough implementations. I'd rather land this first, I don't consider this additional trait to be that much overhead.
@@ -189,6 +204,52 @@ macro_rules! impl_dyn_provider { | |||
$crate::serde::SerializeMarker | |||
); | |||
}; | |||
($provider:ty, [ $($struct_m:ty),+, ], SERDE_SE, impl DataConverter) => { |
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 macro is getting massive. Now that we have a datagen
feature we could split it into what it was before #1595, and a second macro (impl_datagen_provider
) that additionally implements IterableDynProvider
and DataConverter
(and which we can also put behind the datagen
feature).
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 waiting for the ResourceProvider stuff to happen before making further changes 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.
What ResourceProvider stuff?
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.
#1554 was the main thing, but I believe there's more stuff to be done here around Buffer and Any providers, especially using the new Convert infrastructure. Shane's got a whole plan 😄 (I can't find the right issue at the moment)
.help("Load input data from the icu_testdata project."), | ||
) | ||
.arg( | ||
Arg::with_name("KEYS") |
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.
Also add ALL_KEYS
?
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.
(touch)
f94ec0d
to
4c8b208
Compare
Notice: the branch changed across the force-push!
~ Your Friendly Jira-GitHub PR Checker Bot |
Rebased over segmenter changes, no changes between your last review and this except for 4c8b208 and merge conflict resolution |
.help("Load input data from the icu_testdata project."), | ||
) | ||
.arg( | ||
Arg::with_name("KEYS") |
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.
The difference with ALL_KEYS
over TEST_KEYS
is that in line 220 we wouldn't ignore key errors.
/// A blanket-implemented trait that allows for all the datagen-relevant traits | ||
/// to be used in trait objects. The type parameter is the marker type needed for | ||
/// [`IterableDynProvider`]. | ||
pub trait OmnibusDatagenProvider<M: DataMarker>: |
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.
That is a cool solution, can you incorporate #1684 ?
@@ -189,6 +204,52 @@ macro_rules! impl_dyn_provider { | |||
$crate::serde::SerializeMarker | |||
); | |||
}; | |||
($provider:ty, [ $($struct_m:ty),+, ], SERDE_SE, impl DataConverter) => { |
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.
What ResourceProvider stuff?
Fixes #1512, fixes #1661
This adds
icu4x-verify-zero-copy
, that loadstestdata.postcard
and deserializes each entry that it knows to look for to its specific data struct type, while measuring heap usage. It then reports which keys have non-zero-copy data structs. (this is #1661)This also updates
impl_dyn_provider!()
to be able to provideDataConverter
impls that act as a "data registry" (#1512), allowing one to convert between different dynamic marker types via intermediate downcasting.Todo: