From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.2 (2018-09-13) on dcvr.yhbt.net X-Spam-Level: X-Spam-Status: No, score=-4.0 required=3.0 tests=ALL_TRUSTED,AWL,BAYES_00 shortcircuit=no autolearn=ham autolearn_force=no version=3.4.2 Received: from localhost (dcvr.yhbt.net [127.0.0.1]) by dcvr.yhbt.net (Postfix) with ESMTP id 2BBEE1FBC6 for ; Wed, 10 Jun 2020 07:08:34 +0000 (UTC) From: Eric Wong To: meta@public-inbox.org Subject: [PATCH 79/82] imapd: don't bother sorting LIST output Date: Wed, 10 Jun 2020 07:05:16 +0000 Message-Id: <20200610070519.18252-80-e@yhbt.net> In-Reply-To: <20200610070519.18252-1-e@yhbt.net> References: <20200610070519.18252-1-e@yhbt.net> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit List-Id: The sort was unstable on my test instance anyways, and clients don't seem to mind. So stop wasting CPU cycles. --- lib/PublicInbox/IMAPD.pm | 5 ----- t/imapd.t | 4 +++- 2 files changed, 3 insertions(+), 6 deletions(-) diff --git a/lib/PublicInbox/IMAPD.pm b/lib/PublicInbox/IMAPD.pm index fe50de0f7cd..09bedf5ca9b 100644 --- a/lib/PublicInbox/IMAPD.pm +++ b/lib/PublicInbox/IMAPD.pm @@ -74,11 +74,6 @@ sub imapd_refresh_finalize { my $u = $_; # capitalize "INBOX" for user-familiarity $u =~ s/\Ainbox(\.|\z)/INBOX$1/i; qq[* LIST (\\Has${no}Children) "." $u\r\n] - } sort { - # shortest names first, alphabetically if lengths match - length($a) == length($b) ? - ($a cmp $b) : - (length($a) <=> length($b)) } keys %$mailboxes ]; $imapd->{pi_config} = $pi_config; diff --git a/t/imapd.t b/t/imapd.t index e3cce2d30f0..c7e0baaa10b 100644 --- a/t/imapd.t +++ b/t/imapd.t @@ -405,7 +405,9 @@ is($r2->{2}->{'BODY[HEADER.FIELDS (MESSAGE-ID)]'}, pop @new_list; pop @orig_list; # TODO: not sure if sort order matters, imapd_refresh_finalize - # sorts, for now, but maybe clients don't care... + # doesn't sort, hopefully clients don't care... + @new_list = sort @new_list; + @orig_list = sort @orig_list; is_deeply(\@new_list, \@orig_list, 'LIST identical'); } ok($mic->close, 'CLOSE works');