]> Sergey Matveev's repositories - public-inbox.git/commitdiff
nntp: reduce syscalls for LIST OVERVIEW.FMT
authorEric Wong <e@80x24.org>
Wed, 30 Sep 2015 21:00:18 +0000 (21:00 +0000)
committerEric Wong <e@80x24.org>
Wed, 30 Sep 2015 21:09:17 +0000 (21:09 +0000)
No point in sending such a short, bounded response with
multiple syscalls.

lib/PublicInbox/NNTP.pm

index faa756345a396ab42293453c167d11e2e99ad0ff..dc4227ece87cf2e042ac793780268aebeca53cee 100644 (file)
@@ -24,7 +24,7 @@ use constant {
 sub now () { clock_gettime(CLOCK_MONOTONIC) };
 
 my @OVERVIEW = qw(Subject From Date Message-ID References Bytes Lines);
-my %OVERVIEW = map { $_ => 1 } @OVERVIEW;
+my $OVERVIEW_FMT = join(":\r\n", @OVERVIEW) . ":\r\n";
 
 # disable commands with easy DoS potential:
 # LISTGROUP could get pretty bad, too...
@@ -90,9 +90,9 @@ sub cmd_xgtitle ($;$) {
        '.'
 }
 
-sub list_overview_fmt ($$) {
+sub list_overview_fmt ($) {
        my ($self) = @_;
-       more($self, $_ . ':') foreach @OVERVIEW;
+       do_more($self, $OVERVIEW_FMT);
 }
 
 sub list_active ($;$) {