Skip to content

Commit

Permalink
Merge pull request #246 from clue-labs/notime
Browse files Browse the repository at this point in the history
Improve performance of `StreamSelectLoop` when no timers are scheduled
  • Loading branch information
WyriHaximus committed Feb 23, 2022
2 parents 4d3e4aa + a893385 commit cd3f42b
Showing 1 changed file with 5 additions and 0 deletions.
5 changes: 5 additions & 0 deletions src/Timer/Timers.php
Original file line number Diff line number Diff line change
Expand Up @@ -73,6 +73,11 @@ public function isEmpty()

public function tick()
{
// hot path: skip timers if nothing is scheduled
if (!$this->schedule) {
return;
}

// ensure timers are sorted so we can execute in order
if (!$this->sorted) {
$this->sorted = true;
Expand Down

0 comments on commit cd3f42b

Please sign in to comment.