]> Sergey Matveev's repositories - public-inbox.git/commitdiff
git-http-backend: favor sysread for regular files
authorEric Wong <e@80x24.org>
Sat, 5 Mar 2016 00:24:16 +0000 (00:24 +0000)
committerEric Wong <e@80x24.org>
Sat, 5 Mar 2016 00:24:16 +0000 (00:24 +0000)
We do not need line buffering, here; so favor sysread to
bypass extra copies which may be done by normal read.

lib/PublicInbox/GitHTTPBackend.pm

index c84eefcfa3ac15a9e366a0a3d4f8136c3d6f0d3c..50bb4331f5aaaa017b21d846fdbd040d32d0ca79 100644 (file)
@@ -73,7 +73,7 @@ sub serve {
                my $n = 8192;
                while ($len > 0) {
                        $n = $len if $len < $n;
-                       my $r = read($in, $buf, $n);
+                       my $r = sysread($in, $buf, $n);
                        last if (!defined($r) || $r <= 0);
                        $len -= $r;
                        $fh->write($buf);