[prev in list] [next in list] [prev in thread] [next in thread] 

List:       listar-dev
Subject:    [LDev] in search of a better tolist_cmp?
From:       Tim Pierce <twp () rootsweb ! com>
Date:       2000-01-19 6:34:59
[Download RAW message or body]

Hi, gang -

Listar's ability to sort the recipient list by domain is of particular
interest to me, because that is one of the chief reasons we use
SmartList at work.  I've been looking at the tolist-sorting code
tonight and wanted to toss around a couple of ideas.

1. tolist_cmp sorts not only by domain/hostname, but also by username.
   This is a little puzzling.  From the MTA's perspective, all users
   in a domain are interchangable -- there should be no efficiency
   advantage to sorting the usernames.  Sorting is only useful because
   it groups recipients at the same host or domain together and permits
   batched delivery.  Could tolist_cmp gain some efficiency by returning
   0 whenever it finds two users at the same host?  Would some useful
   feature be lost?

   SmartList actually pulls a neat hack here.  Instead of parsing
   addresses into userid, hostname and domain, it just blindly
   reverses every address and does a raw comparison on those.  In
   other words, instead of comparing
	jenny@example.com to
	ralph@mail.example.com,
   it compares
	moc.elpmaxe@ynnej to
	moc.elpmaxe@hplar
   This turns out to be a really efficient way to sort addresses
   by domain, and I confess I haven't found a reason not to do it
   this way.

2. The list admin has the option of turning off list sorting for
   "megalists," because qsort is a memory hog.  It might make more
   sense to revert to a mergesort for really large subscriber lists;
   while not quite as efficient as quicksort, mergesort is still
   pretty fast and is tailor-made for sorting more data than can
   comfortably fit in core.  I haven't thought out all the
   ramifications of doing this, but would be interested in hearing
   your thoughts.

-- 
Regards,
Tim Pierce
RootsWeb.com lead system admonsterator
and Chief Hacking Officer

[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic