-
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
Add BlobSchema V2 with ZeroTrie #4207
Conversation
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 also add ZeroHashMap to these comparisons. For example the key lookup even for ZeroAsciiTrie can be a ZHM.
- Speed up resource lookup and fallback at runtime #2699 is not in the 1.4 milestone. If you want to submit this non-experimentally it should be
I added this PR to the 1.4 milestone for tracking the new feature, left a comment on #2699 about investigating ZeroHashMap, and moved the issue to backlog. |
Also filed #4216 for further discussion. |
Bench results:
|
let mut version = 1; | ||
|
||
{ | ||
let mut exporter = BlobExporter::new_with_sink(Box::new(&mut blob)); | ||
while version <= 2 { |
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.
let mut version = 1; | |
{ | |
let mut exporter = BlobExporter::new_with_sink(Box::new(&mut blob)); | |
while version <= 2 { | |
for version in [1, 2] { |
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.
done
exporter.close().unwrap(); | ||
let mut version = 1; | ||
|
||
while version <= 2 { |
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.
same
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.
done
b.iter(|| { | ||
for locale in black_box(&locales).iter() { | ||
let _: DataResponse<HelloWorldV1Marker> = black_box(&provider) | ||
.as_deserializing() |
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.
nit: I'd prefer benching this as a BufferProvider
without deserialization
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.
done
provider/blob/src/blob_schema.rs
Outdated
.locales | ||
.get(idx0) | ||
.ok_or_else(|| DataError::custom("Invalid blob bytes").with_req(key, req))?; | ||
// TODO: Add a lookup function to zerotrie so we don't need to stringify |
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.
issue?
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.
provider/blob/src/blob_schema.rs
Outdated
.ok_or_else(|| DataError::custom("Invalid blob bytes").with_req(key, req))?; | ||
// TODO: Add a lookup function to zerotrie so we don't need to stringify | ||
let locale_str = req.locale.write_to_string(); | ||
let idx1 = ZeroTrieSimpleAscii::from_store(zerotrie) |
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.
blob_index
?
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.
Done
provider/blob/tests/test_versions.rs
Outdated
run_driver(exporter).unwrap(); | ||
assert_eq!(BLOB_V1, blob.as_slice()); | ||
|
||
let blob_privider = BlobDataProvider::try_new_from_blob(blob.into_boxed_slice()).unwrap(); |
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.
typo
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.
fixed
pub fn new_with_sink(sink: Box<dyn std::io::Write + Sync + 'w>) -> Self { | ||
Self { | ||
resources: Mutex::new(Vec::new()), | ||
resources: Mutex::new(BTreeMap::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.
nit: change to Default::default()
where possible
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.
done
New bench results: after switching to testing only load_buffer:
|
Co-authored-by: Robert Bastian <4706271+robertbastian@users.noreply.github.com>
Co-authored-by: Robert Bastian <4706271+robertbastian@users.noreply.github.com>
Part of #3865
Relates to #2699
Need to investigate the test failures but this should be mostly ready.