user/dev discussion of public-inbox itself
 help / color / Atom feed
* [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	[flat|nested] only message in thread

only message in thread, back to index

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

user/dev discussion of public-inbox itself

Archives are clonable:
	git clone --mirror
	git clone --mirror http://czquwvybam4bgbro.onion/meta
	git clone --mirror http://hjrcffqmbrq6wope.onion/meta
	git clone --mirror http://ou63pmih66umazou.onion/meta

Example config snippet for mirrors

Newsgroups are available over NNTP:

 note: .onion URLs require Tor:

AGPL code for this site: git clone