Skip to content

Commit

Permalink
Merge #442
Browse files Browse the repository at this point in the history
442: Do not perform superfluous bounds checks on dropping crossbeam-epoch::Bag r=jeehoonkang a=Shnatsel

Addresses [this comment](#414 (comment)) that I didn't get a chance to act upon before merging #414. 

This way bounds checks should be performed only once. However, this does not measurably impact benchmarks.

Co-authored-by: Sergey "Shnatsel" Davidoff <[email protected]>
  • Loading branch information
bors[bot] and Shnatsel authored Oct 27, 2019
2 parents d2ab7a5 + ebb6b5f commit 99762ee
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions crossbeam-epoch/src/internal.rs
Original file line number Diff line number Diff line change
Expand Up @@ -133,10 +133,10 @@ impl Default for Bag {
impl Drop for Bag {
fn drop(&mut self) {
// Call all deferred functions.
for i in 0..self.len {
for deferred in &mut self.deferreds[..self.len] {
let no_op = Deferred::new(no_op_func);
let deferred = mem::replace(&mut self.deferreds[i], no_op);
deferred.call();
let owned_deferred = mem::replace(deferred, no_op);
owned_deferred.call();
}
}
}
Expand Down

0 comments on commit 99762ee

Please sign in to comment.