Skip to content

Commit

Permalink
Add a comment about CPU-dependent performance w.r.t. caching
Browse files Browse the repository at this point in the history
  • Loading branch information
mgeier committed Dec 29, 2024
1 parent 51c9dca commit 951d3d6
Showing 1 changed file with 4 additions and 0 deletions.
4 changes: 4 additions & 0 deletions src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -289,6 +289,8 @@ pub struct Producer<T> {
/// A copy of `buffer.tail` for quick access.
///
/// This value is always in sync with `buffer.tail`.
// NB: Caching the tail seems to have little effect on Intel CPUs, but it seems to
// improve performance on AMD CPUs, see https://github.com/mgeier/rtrb/pull/132
cached_tail: Cell<usize>,
}

Expand Down Expand Up @@ -496,6 +498,8 @@ pub struct Consumer<T> {
/// A copy of `buffer.head` for quick access.
///
/// This value is always in sync with `buffer.head`.
// NB: Caching the head seems to have little effect on Intel CPUs, but it seems to
// improve performance on AMD CPUs, see https://github.com/mgeier/rtrb/pull/132
cached_head: Cell<usize>,

/// A copy of `buffer.tail` for quick access.
Expand Down

0 comments on commit 951d3d6

Please sign in to comment.