* [PATCH] scripts/slrnspool2maildir: don't sort glob()
@ 2020-05-02 21:22 Eric Wong
0 siblings, 0 replies; only message in thread
From: Eric Wong @ 2020-05-02 21:22 UTC (permalink / raw)
To: meta
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;
^ permalink raw reply related [flat|nested] only message in thread
only message in thread, other threads:[~2020-05-02 21:22 UTC | newest]
Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-05-02 21:22 [PATCH] scripts/slrnspool2maildir: don't sort glob() Eric Wong
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).