-
Notifications
You must be signed in to change notification settings - Fork 12
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
Switch to structured errors, inline encoding #48
Conversation
I'm seeing some different results: On x86 I see some 10-15% improvements to encode, but no change for decode.
On my aarch64 machine, large regression in encode and 10-15% improvement in decode.
This reminds me of the "touchy" madness I was talking about earlier. Can you provide any platform details? |
Ugh. My results are on macOS
|
What I find most confusing here is that you're seeing regressions on the same platform. Different processor? I'm using an M2 pro plugged into mains power. I can try updating my macOS version too. |
OK, more attempts at consistency.
|
I keep reading this: https://bheisler.github.io/criterion.rs/book/user_guide/command_line_options.html#baselines
but cannot understand the difference between |
Oh yeah it's confusing but the actual example below it makes sense? |
Ah, I see. It made sense once I just tried to run it. So |
I also just found this, which works very well and can actually be understood: |
I'm on M1, but I'd be surprised if there'd be much difference between the architectures of M1 and M2/M3. Since I'm seeing mostly positive results on x64_64, mixed results on aarch64, and because I think it's "better" to have structural vs. String errors, I think we should merge this. |
let mut shift = 0; | ||
let mut result = 0; | ||
while let Some((idx, mut byte)) = chars.next() { | ||
for (idx, mut byte) in chars.by_ref() { |
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.
Nice.
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.
clippy 😎
Ooo this is nice. |
This PR switches to "real" structured errors, and inlines an encoding step. Perf compared to current
main
:The inlining improves encoding perf. Without inlining, the change to structured errors improves decoding perf as above, but regresses encoding perf by 10 - 12 %.
Please feel free to bikeshed the
Error
impl: I usually use thiserror for everything but since this crate doesn't depend ongeo
I didn't want to introduce another dependency.