From: Eric Wong Date: Sun, 22 May 2016 06:17:30 +0000 (+0000) Subject: http: pass reference to Danga::Socket::write X-Git-Tag: v1.0.0~512 X-Git-Url: http://www.git.stargrave.org/?a=commitdiff_plain;ds=sidebyside;h=d644f8903b8dd4f9765fd0f88cc8e0d9fa5f6a5e;p=public-inbox.git http: pass reference to Danga::Socket::write This can avoid an expensive copy for big strings. --- diff --git a/lib/PublicInbox/HTTP.pm b/lib/PublicInbox/HTTP.pm index 6576bf68..4eb14481 100644 --- a/lib/PublicInbox/HTTP.pm +++ b/lib/PublicInbox/HTTP.pm @@ -200,7 +200,7 @@ sub response_write { my $alive = response_header_write($self, $env, $res); # middlewares such as Deflater may write empty strings - my $write = sub { $self->write($_[0]) if $_[0] ne '' }; + my $write = sub { $self->write(\($_[0])) if $_[0] ne '' }; my $close = sub { if ($alive) { $self->event_write; # watch for readability if done