Skip to content

Commit cd3f42b

Browse files
authored
Merge pull request #246 from clue-labs/notime
Improve performance of `StreamSelectLoop` when no timers are scheduled
2 parents 4d3e4aa + a893385 commit cd3f42b

File tree

1 file changed

+5
-0
lines changed

1 file changed

+5
-0
lines changed

src/Timer/Timers.php

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -73,6 +73,11 @@ public function isEmpty()
7373

7474
public function tick()
7575
{
76+
// hot path: skip timers if nothing is scheduled
77+
if (!$this->schedule) {
78+
return;
79+
}
80+
7681
// ensure timers are sorted so we can execute in order
7782
if (!$this->sorted) {
7883
$this->sorted = true;

0 commit comments

Comments
 (0)