-
Notifications
You must be signed in to change notification settings - Fork 116
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
rust: add sans-io indexed reader #1338
base: main
Are you sure you want to change the base?
Conversation
e8926a8
to
1213557
Compare
67b8db0
to
4758b0e
Compare
4758b0e
to
8b68bc1
Compare
c1e06e5
to
f311f5b
Compare
63bdb2a
to
cccf207
Compare
d6ccbbf
to
1ddd5b2
Compare
} | ||
// index the current chunk slot | ||
// before starting, check if all existing message indexes have been exhausted - | ||
// if so, clear them out now. |
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.
Why do we do this? Some extra explanation would be good.
8fb9e92
to
67847e7
Compare
94aac48
to
6a57a74
Compare
6a57a74
to
863d3f8
Compare
expected.sort_by(|a, b| a.1.cmp(&b.1)); | ||
expected.reverse(); |
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.
expected.sort_by(|a, b| a.1.cmp(&b.1)); | |
expected.reverse(); | |
expected.sort_by_key(|(_, log_time)| std::cmp::Reverse(log_time)); |
ReadOrder::ReverseLogTime, | ||
ReadOrder::File, | ||
] { | ||
let mut expected: Vec<(u16, u64)> = chunks.iter().cloned().flatten().cloned().collect(); |
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.
cloned()
twice?
Changelog
mcap::sans_io::SummaryReader
andmcap::sans_io::IndexedReader
structs, which can be used to a) parse out summary information and b) read messages efficiently using that summary information.Docs
See
cargo doc
for usage info.Description
Adds a sans-io indexed reading implementation, including conformance tests and benchmarks.
Benchmarks
The indexed reader is suspiciously faster than MessageStream by quite a bit. I suspect the major difference is that the indexed reader allows the caller to re-use the same buffer for every message yielded, rather than allocating a new one.
Raw
cargo bench
outputs (with changes removed because they compare to the previous run, which is confusing)