]> Sergey Matveev's repositories - public-inbox.git/commitdiff
searchmsg: do not memoize {date} field
authorEric Wong <e@80x24.org>
Sat, 17 Dec 2016 12:04:11 +0000 (12:04 +0000)
committerEric Wong <e@80x24.org>
Sat, 17 Dec 2016 22:40:28 +0000 (22:40 +0000)
We only generate the ->date once in NNTP, so creating
the hash entry is a waste.

lib/PublicInbox/SearchMsg.pm

index 4c65fbe01a20fb15f36d10b3d1b3dd0cc85c6896..d62f02c8487f6baebfd783701d5fe67ec79b69fe 100644 (file)
@@ -76,13 +76,10 @@ my @MoY = qw(Jan Feb Mar Apr May Jun Jul Aug Sep Oct Nov Dec);
 
 sub date ($) {
        my ($self) = @_;
-       my $date = __hdr($self, 'date');
-       return $date if defined $date;
        my $ts = $self->{ts};
        return unless defined $ts;
        my ($sec, $min, $hour, $mday, $mon, $year, $wday) = gmtime($ts);
-       $self->{date} = "$DoW[$wday], ".
-                       sprintf("%02d $MoY[$mon] %04d %02d:%02d:%02d +0000",
+       "$DoW[$wday], " . sprintf("%02d $MoY[$mon] %04d %02d:%02d:%02d +0000",
                                $mday, $year+1900, $hour, $min, $sec);
 
 }