Skip to content

Commit

Permalink
a few more small optimizations
Browse files Browse the repository at this point in the history
  • Loading branch information
kraih committed May 9, 2013
1 parent ff28702 commit eb0cd7d
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 6 deletions.
8 changes: 5 additions & 3 deletions Changes
@@ -1,8 +1,10 @@

4.0 2013-05-09
4.0 2013-05-10
- Code name "Top Hat", this is a major release.
- Added simple JSON serialization support to Mojo::Transaction::WebSocket.
- Added json event to Mojo::Transaction::WebSocket.
- Added again method to Mojo::Reactor, Mojo::Reactor::Poll and
Mojo::Reactor::EV.
- Added is_empty method to Mojo::Transaction::HTTP.
- Added close_gracefully method to Mojo::IOLoop::Stream.
- Changed Mojolicious default secret to the application moniker to make it
Expand All @@ -20,10 +22,10 @@
- Reduced idle CPU usage of Mojo::IOLoop.
- Increased default lock_timeout from 0.5 to 1 second in
Mojo::Server::Prefork and Mojo::Server::Hypnotoad.
- Improved Mojo::IOLoop performance significantly and reduced CPU usage when
managing more than 10k concurrent connections.
- Improved Mojolicious to be able to detect the current operating mode from
the PLACK_ENV environment variable.
- Improved Mojo::IOLoop performance by reducing stream timeout precision
from 0.5 to 1 second.
- Improved Mojo::DOM::HTML performance.
- Improved html_unescape performance in Mojo::Util.
- Improved Mojolicious::Plugin::EPLRenderer to cache templates more
Expand Down
5 changes: 2 additions & 3 deletions lib/Mojo/IOLoop/Stream.pm
Expand Up @@ -18,8 +18,7 @@ sub close {

# Cleanup
return unless my $reactor = $self->{reactor};
$reactor->remove(delete $self->{timer}) if $self->{timer};
return unless my $handle = delete $self->{handle};
return unless my $handle = delete $self->timeout(0)->{handle};
$reactor->remove($handle);

close $handle;
Expand Down Expand Up @@ -75,10 +74,10 @@ sub timeout {
my $self = shift;

return $self->{timeout} unless @_;

my $reactor = $self->reactor;
$reactor->remove(delete $self->{timer}) if $self->{timer};
return $self unless my $timeout = $self->{timeout} = shift;

weaken $self;
$self->{timer} = $reactor->recurring(
$timeout => sub { $self->emit_safe('timeout')->close });
Expand Down

0 comments on commit eb0cd7d

Please sign in to comment.