mirror of
https://github.com/tokio-rs/bytes.git
synced 2026-08-24 00:00:14 +02:00
Be clear about Inner::kind being deliberate UB (#236)
This commit is contained in:
@@ -2429,6 +2429,10 @@ impl Inner {
|
|||||||
// bits, so even without any explicit atomic operations, reading the
|
// bits, so even without any explicit atomic operations, reading the
|
||||||
// flag will be correct.
|
// flag will be correct.
|
||||||
//
|
//
|
||||||
|
// This is undefind behavior due to a data race, but experimental
|
||||||
|
// evidence shows that it works in practice (discussion:
|
||||||
|
// https://internals.rust-lang.org/t/bit-wise-reasoning-for-atomic-accesses/8853).
|
||||||
|
//
|
||||||
// This function is very critical performance wise as it is called for
|
// This function is very critical performance wise as it is called for
|
||||||
// every operation. Performing an atomic load would mess with the
|
// every operation. Performing an atomic load would mess with the
|
||||||
// compiler's ability to optimize. Simple benchmarks show up to a 10%
|
// compiler's ability to optimize. Simple benchmarks show up to a 10%
|
||||||
|
|||||||
Reference in New Issue
Block a user