Skip to content

Commit

Permalink
improved Mojo::Reactor::Poll performance
Browse files Browse the repository at this point in the history
  • Loading branch information
kraih committed May 10, 2013
1 parent fe66d95 commit 28dd8ad
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 2 deletions.
1 change: 1 addition & 0 deletions Changes
Expand Up @@ -28,6 +28,7 @@
the PLACK_ENV environment variable.
- Improved renderer performance.
- Improved Mojo::DOM::HTML performance.
- Improved Mojo::Reactor::Poll performance.
- Improved html_unescape performance in Mojo::Util.
- Improved Mojolicious::Plugin::EPLRenderer to cache templates more
efficiently.
Expand Down
5 changes: 3 additions & 2 deletions lib/Mojo/Reactor/Poll.pm
Expand Up @@ -52,12 +52,13 @@ sub one_tick {
elsif ($timeout) { usleep $timeout * 1000000 }

# Timers
my $now = steady_time;
for my $id (keys %{$self->{timers}}) {
next unless my $t = $self->{timers}{$id};
next unless $t->{time} <= (my $time = steady_time);
next unless $t->{time} <= $now;

# Recurring timer
if (exists $t->{recurring}) { $t->{time} = $time + $t->{recurring} }
if (exists $t->{recurring}) { $t->{time} = $now + $t->{recurring} }

# Normal timer
else { $self->remove($id) }
Expand Down

0 comments on commit 28dd8ad

Please sign in to comment.