From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on dcvr.yhbt.net X-Spam-Level: X-Spam-ASN: X-Spam-Status: No, score=-4.2 required=3.0 tests=ALL_TRUSTED,AWL,BAYES_00, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF, T_SCC_BODY_TEXT_LINE shortcircuit=no autolearn=ham autolearn_force=no version=3.4.6 Received: from localhost (dcvr.yhbt.net [127.0.0.1]) by dcvr.yhbt.net (Postfix) with ESMTP id 68E8E1F4B8 for ; Tue, 23 Jan 2024 22:09:01 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=80x24.org; s=selector1; t=1706047741; bh=HNz98/G9HzFjVLJxddeeT0m4TxUGfbZgldJxE0oKENw=; h=From:To:Subject:Date:In-Reply-To:References:From; b=gSflFVpRLEZB47vQS6KKlhmjTDHs/Oj1TX6rDqROErVJGXRjy4brmBwp5sqAuz/n7 Zb6mBioFQQWkABaeRfSHyIDgisayBzmkx9zuVdlvDH2F6sl6l+2qeFnm/RFBWNqC0U xPIWoyiqRqyZTwcUz7gaPhTz47yrMGERLYYVW21g= From: Eric Wong To: meta@public-inbox.org Subject: [PATCH 1/2] www_topics: simplify date column mapping Date: Tue, 23 Jan 2024 22:08:59 +0000 Message-Id: <20240123220900.2045016-2-e@80x24.org> In-Reply-To: <20240123220900.2045016-1-e@80x24.org> References: <20240123220900.2045016-1-e@80x24.org> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit List-Id: We can rely on SQLite to map `MAX(ds)' to `ds' rather than doing it in Perl, reducing the size of our Perl optree at the (smaller) expense of SQLite bytecode. --- lib/PublicInbox/WwwTopics.pm | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/lib/PublicInbox/WwwTopics.pm b/lib/PublicInbox/WwwTopics.pm index ad85a46d..9d270732 100644 --- a/lib/PublicInbox/WwwTopics.pm +++ b/lib/PublicInbox/WwwTopics.pm @@ -9,7 +9,7 @@ sub add_topic_html ($$) { my (undef, $smsg) = @_; my $s = ascii_html($smsg->{subject}); $s = '(no subject)' if $s eq ''; - $_[0] .= "\n".fmt_ts($smsg->{'MAX(ds)'} // $smsg->{ds}) . + $_[0] .= "\n".fmt_ts($smsg->{ds}) . qq{ {mid}).qq{/#r">$s}; my $nr = $smsg->{'COUNT(num)'}; $_[0] .= " $nr+ messages" if $nr > 1; @@ -29,7 +29,7 @@ EOS sub topics_active ($) { $_[0]->do_get(< 0 ORDER BY ts DESC LIMIT 200) AND +num > 0 GROUP BY tid @@ -43,7 +43,6 @@ sub topics_atom { # GET /$INBOX_NAME/topics_(new|active).atom my ($ctx) = @_; require PublicInbox::WwwAtomStream; my ($hdr, $smsg, $val); - $_->{ds} //= $_->{'MAX(ds)'} // 0 for @{$ctx->{msgs}}; PublicInbox::WwwAtomStream->response($ctx, \&topics_i); }