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
Const guid #279
Const guid #279
Conversation
@kennykerr this is ready for review. It won't pass CI until I update const-sha1 with the changes necessary to get this to work, but I'd like to have your eyes on this before I push a new version. Once that's done, I'll push a new version of const-sha1 and we can merge this. One thing we'll need to consider is that this will cause the crate to only work on beta. If we want we can wait until the next release of Rust before merging 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.
Thanks!
Can't wait to do some run time comparative performance testing with this change. |
Note that this is a breaking change for consumers of (It might also be a breaking change because of the MSRV.) |
Yes, our next version will be 0.8 for multiple reasons 👍 . |
Here's the performance impact of const guids. Consider the following sample: fn main() -> Result<()> {
let uri = Uri::create_uri("http://kennykerr.ca")?;
let query = uri.query_parsed()?;
let start = std::time::Instant::now();
for _ in 0..1_000_000 {
let s = query.size()?;
debug_assert!(s == 0);
}
println!("{:5}ms", start.elapsed().as_millis());
Ok(())
} The Before this commit:
After this commit:
That's about 40 times faster and on par with C++/WinRT. |
Fixes #136
Note that this will push the MSRV to Rust 1.46 which is currently in beta.