Reuse AsRef and AsMut as possible to reduce unsafe#25
Reuse AsRef and AsMut as possible to reduce unsafe#25lo48576 wants to merge 1 commit intofitzgen:masterfrom
AsRef and AsMut as possible to reduce unsafe#25Conversation
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
unsafeblock, but they can be shared to reduce duplicates.