Article View: news.software.nntp
Article #64517Re: Newsreader programming - sorting one million lines ?
From: Juergen Helbing
Date: Tue, 25 Mar 2003 06:25
Date: Tue, 25 Mar 2003 06:25
58 lines
2749 bytes
2749 bytes
jeff@litech.org (Jeffrey M. Vinocur) wrote: >>How do you sort your header-lists if they dont fit into memory ? > >Well, in principle a modern memory manager should take care of >writing them to disk as needed. (That is, most of the time >virtual memory will suffice, rather than you having to open a >temporary file yourself.) You are right - but we are talking about 1e6 headers with a total size of approx 1 gig. >I wonder if the reason you're having problems is that your sort >algorithm has poor locality, causing a lot of swapping. Right now my 150.000 headers are kept fully in memory (50-75 megs). There is no swapping at all (on a 256 MB RAM machine). But this does no longer work with 6 times the quantity. That's why I'm looking for better methods. >I just poked at the source for GNU sort(1) from the textutils >package, and it seems to be using mergesort, which surely would >have better cache locality than quicksort. You might try that, Thanks for the tip. >Otherwise, I'd say it's time to consult an algorithmicist. >Either ask in an appropriate newsgroup, or find a textbook. (I >just checked the Cormen/Leiserson/Rivest text and didn't see >anything useful, perhaps Knuth would be an appropriate resource.) Normally I am one of the specialists for collecting and analysing huge masses of measurement trend data. In a scientific project I had evaluated the "magic triangle" of of the design targets: "time-to-insert sequentially", "time-to-retrieve randomly" and "disk-space"..... But because that project was done in 1980 I thought it would be a nice idea to ask here if something changed significantly meanwhile.... I will now either implement full sorting indexes for all criteria or I will restrict the users to 150.000 items with the chance to page forward and backwards in the list by date.. (last week, two weeks ago, ....) Thanks for your answer. -- Juergen
Technical Details
Message-ID:
<47257.p33207@archiver.winews.net>Path:
mbox-mo1.pugleaf.net!archive.usenet.blueworldhosting.com!illumos!news.pugleaf.net!.TX!archive.pugleaf.net!archive.newsdeef.eu!mbox2nntp-news.software.nntp.mbox.zip!archiver1.google.com!news1.google.com!newsfeed.stanford.edu!news.ems.psu.edu!news.litech.org!news-xfer.cox.net!news.lightlink.com!news.alt.net!usenetReferences:
<4540d.o33203@archiver.winews.net> <b5ob7g$akq$1@puck.litech.org>Show Full Headers
Complete Article Headers
Message-ID: <47257.p33207@archiver.winews.net> Subject: Re: Newsreader programming - sorting one million lines ? Date: Tue, 25 Mar 2003 06:25:47 +0000 From: archiver@i3w.com (Juergen Helbing) References: <4540d.o33203@archiver.winews.net> <b5ob7g$akq$1@puck.litech.org> Path: mbox-mo1.pugleaf.net!archive.usenet.blueworldhosting.com!illumos!news.pugleaf.net!.TX!archive.pugleaf.net!archive.newsdeef.eu!mbox2nntp-news.software.nntp.mbox.zip!archiver1.google.com!news1.google.com!newsfeed.stanford.edu!news.ems.psu.edu!news.litech.org!news-xfer.cox.net!news.lightlink.com!news.alt.net!usenet Newsgroups: news.software.nntp Organization: Altopia Corp. - Usenet Access - http://www.altopia.com Lines: 57 X-Newsreader: MyNews