We don't bite newbies here... much | |
PerlMonks |
comment on |
( [id://3333]=superdoc: print w/replies, xml ) | Need Help?? |
I've been working (for far too long) on a mail-script to
deliver to 50,000 users (more added every week). It's got to
the point where it's grinding the mail-server, particularly
if there are invalid addresses in the list.
It occurred to me that I could optimise this by delivering to the most frequent addresses first: should save on nslookups, and frequently-appearing hostnames are more likely to be valid than the "go@away.no.spam" variety. About 80% of the list should be processed before I run into the single-user hostnames. The most frequently occurring hostname is on the same host as the mailing program, so this 40% of the list should be delivered almost immediately. (BTW, the host doesn't use sendmail - I don't get to choose the MTA.) Here's the outline of the code I produced, and I'd be grateful for any comments about how I could do this more efficiently. It's not bad atm, sorting the 50,000 addresses in ~ 3 secs, but I'm sure there's another and probably more efficient way to do it.
So I'm naturally concerned about the wild proliferation of (often one-element) arrays, even though these are exterminated later. TIA. In reply to Sorting a list by frequency of items by yojimbo
|
|