-
Notifications
You must be signed in to change notification settings - Fork 11
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
Reuse AsRef
and AsMut
as possible to reduce unsafe
#25
base: master
Are you sure you want to change the base?
Conversation
Some trait implementations share the same codes which contain `unsafe` block, but they can be shared to reduce duplicates.
Hi, Yoshioka! Thanks for the patch! I've noticed that we don't have I understand that the actual difference might be non-existent or hard to measure due to LLVM optimizations, but I'd say that with this patch we depend on the LLVM optimizations more than before. Also I wonder if Also the extra indirection, going through two traits and through a pointer, means there is more chances for optimizations not to work for some reason (compilers are complex and evolving beasts). Also I suspect that the non-optimized Do you think if maybe some of these concerns are valid? |
TL; DR:
|
I'm of an opinion that in every project we have three implicit priorities: development speed, code quality and performance. These priorities might be very different for different kinds of code.
We can add inline there of course.
Here's a recent example of using explicit inlining in Rust compiler: rust-lang/rust#69256.
Good to know, thanks! |
Some trait implementations share the same codes which contain
unsafe
block, but they can be shared to reduce duplicates.