Skip to content

Commit

Permalink
perf: use less cycles in @timer_helper (#4777)
Browse files Browse the repository at this point in the history
Since the observation of a `null` in the expiration array means there will be no more found, it is pointless to stay in the loop. I expect 1 expiration per callback in the frequent case.
  • Loading branch information
ggreif authored Nov 22, 2024
1 parent cc1eac1 commit aebc110
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions src/prelude/internals.mo
Original file line number Diff line number Diff line change
Expand Up @@ -614,8 +614,8 @@ func @timer_helper() : async () {
for (o in thunks.vals()) {
switch o {
case (?thunk) { ignore thunk() };
case _ { }
case (?thunk) ignore thunk();
case _ return
}
}
};
Expand Down

0 comments on commit aebc110

Please sign in to comment.