From: Eric Wong <e@yhbt.net>
To: meta@public-inbox.org
Subject: [PATCH] scripts/slrnspool2maildir: don't sort glob()
Date: Sat, 2 May 2020 21:22:10 +0000 [thread overview]
Message-ID: <20200502212210.18051-1-e@yhbt.net> (raw)
glob() sorts alphabetically by default, which doesn't have
a useful meaning with many articles. Stop wasting CPU cycles
and memory.
---
scripts/slrnspool2maildir | 3 ++-
1 file changed, 2 insertions(+), 1 deletion(-)
diff --git a/scripts/slrnspool2maildir b/scripts/slrnspool2maildir
index 8e444e84..c36de0c9 100755
--- a/scripts/slrnspool2maildir
+++ b/scripts/slrnspool2maildir
@@ -10,6 +10,7 @@ use strict;
use warnings;
use Email::Filter;
use Email::LocalDelivery;
+use File::Glob qw(bsd_glob GLOB_NOSORT);
sub usage { "Usage:\n".join('',grep(/\t/, `head -n 12 $0`)) }
my $spool = shift @ARGV or die usage();
my $dir = shift @ARGV or die usage();
@@ -21,7 +22,7 @@ foreach my $sub (qw(cur new tmp)) {
mkdir $nd or die "mkdir $nd failed: $!\n";
}
-foreach my $n (grep(/\d+\z/, glob("$spool/*"))) {
+foreach my $n (grep(/\d+\z/, bsd_glob("$spool/*", GLOB_NOSORT))) {
if (open my $fh, '<', $n) {
my $f = Email::Filter->new(data => do { local $/; <$fh> });
my $s = $f->simple;
reply other threads:[~2020-05-02 21:22 UTC|newest]
Thread overview: [no followups] expand[flat|nested] mbox.gz Atom feed
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
List information: http://public-inbox.org/README
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20200502212210.18051-1-e@yhbt.net \
--to=e@yhbt.net \
--cc=meta@public-inbox.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
Code repositories for project(s) associated with this public inbox
https://80x24.org/public-inbox.git
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).