Skip to content

Commit

Permalink
timers: optimize for timeout extension pattern
Browse files Browse the repository at this point in the history
it is more likely an older timeout gets canceled
and replaced. reversing the search might yield
some performance improvement in this case
  • Loading branch information
cmeissl committed Jun 8, 2024
1 parent 2241881 commit a5a1945
Showing 1 changed file with 1 addition and 0 deletions.
1 change: 1 addition & 0 deletions src/sources/timer.rs
Original file line number Diff line number Diff line change
Expand Up @@ -241,6 +241,7 @@ impl TimerWheel {

self.heap
.iter()
.rev()
.find(|data| data.counter == counter)
.map(|data| data.token.take());
}
Expand Down

0 comments on commit a5a1945

Please sign in to comment.