Skip to content

Commit

Permalink
Be clear about Inner::kind being deliberate UB (#236)
Browse files Browse the repository at this point in the history
  • Loading branch information
RalfJung authored and carllerche committed Nov 26, 2018
1 parent b3248c8 commit 9504447
Showing 1 changed file with 4 additions and 0 deletions.
4 changes: 4 additions & 0 deletions src/bytes.rs
Expand Up @@ -2429,6 +2429,10 @@ impl Inner {
// bits, so even without any explicit atomic operations, reading the
// 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
// every operation. Performing an atomic load would mess with the
// compiler's ability to optimize. Simple benchmarks show up to a 10%
Expand Down

0 comments on commit 9504447

Please sign in to comment.