about summary refs log tree commit homepage
path: root/lib/PublicInbox/NNTP.pm
diff options
context:
space:
mode:
Diffstat (limited to 'lib/PublicInbox/NNTP.pm')
-rw-r--r--lib/PublicInbox/NNTP.pm12
1 files changed, 10 insertions, 2 deletions
diff --git a/lib/PublicInbox/NNTP.pm b/lib/PublicInbox/NNTP.pm
index 54207500..a37910d1 100644
--- a/lib/PublicInbox/NNTP.pm
+++ b/lib/PublicInbox/NNTP.pm
@@ -722,8 +722,16 @@ sub smsg_range_i {
         my $msgs = $over->query_xover($$beg, $end);
         scalar(@$msgs) or return;
         my $tmp = '';
-        foreach my $s (@$msgs) {
-                $tmp .= $s->{num} . ' ' . $s->$field . "\r\n";
+
+        # ->{$field} is faster than ->$field invocations, so favor that.
+        if ($field eq 'date') {
+                for my $s (@$msgs) {
+                        $tmp .= "$s->{num} ".PublicInbox::Smsg::date($s)."\r\n"
+                }
+        } else {
+                for my $s (@$msgs) {
+                        $tmp .= "$s->{num} $s->{$field}\r\n";
+                }
         }
         utf8::encode($tmp);
         $self->msg_more($tmp);