]> git.ipfire.org Git - thirdparty/public-inbox.git/commitdiff
repobrowse: larger, short-lived buffer for reading patches
authorEric Wong <e@80x24.org>
Wed, 6 Apr 2016 02:41:53 +0000 (02:41 +0000)
committerEric Wong <e@80x24.org>
Wed, 6 Apr 2016 02:43:12 +0000 (02:43 +0000)
Since we do not parse the patch output, we can use a bigger
buffer and localize it to the block for memory savings if
xdiff generation takes a long time.

lib/PublicInbox/RepobrowseGitPatch.pm

index b3cf17fe65624e97f3732ab6da5fc6a1c1a4432a..a6c5aad8970972527cd454c91951734d796f73c6 100644 (file)
@@ -29,7 +29,7 @@ sub call_git_patch {
        my $rpipe = $git->popen(@cmd);
        my $env = $req->{cgi}->env;
        my $err = $env->{'psgi.errors'};
-       my ($buf, $n, $res, $vin, $fh);
+       my ($n, $res, $vin, $fh);
        my $end = sub {
                if ($fh) {
                        $fh->close;
@@ -53,7 +53,7 @@ sub call_git_patch {
                $err->print("git format-patch ($git->{git_dir}): $e\n");
        };
        my $cb = sub {
-               $n = $rpipe->sysread($buf, 8192);
+               $n = $rpipe->sysread(my $buf, 65536);
                return $fail->() unless defined $n;
                return $end->() if $n == 0;
                if ($res) {