🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Article View: news.software.nntp
Article #64521

Re: Newsreader programming - sorting one million lines ?

#64521
From: DS
Date: Tue, 25 Mar 2003 18:50
101 lines
5734 bytes
Can I put in my two cents?

First question- Do you mean 1.5 million msg's ? 

That's ALOT of msg's, or any type of data to sort.

As you know, I'm writing a binary d/l'r (and thank you all for your help, 
again), and I don't see nearly that many msg's (currently available to me 
from 4 differnet servers) in a single group. But I could see it possible, 
maybe. So let me explain a little bit of my development path.

When I began to develop this, I tried in-memory sorting, I tried this, I 
tried that. I could not come up with anything that I felt was high-
performance enough. Using a standard listview didn't work. It was way to 
slow for inserting items into. It could sort faster than me, but took a 
REALLY REALLY long time just to load 50,000 items in to the listview. The 
listview itself sorts pretty fast, but the load delay was crazy.

Without the ability to create my own high performance DB engine & the 
time required (I'm doing this on MY time) , I decided to use an outside 
DB engine.

OK, having zero budget, I had no choice but to use M$ Access db's with 
the Jet DB engine.

There it is, the 'cat's out of the bag'. I was putting off and putting 
off letting people know I was using Jet, thru VB none the less for my 
project. Go ahead, laugh, I know it's coming. Perception's of VB vs. C++. 
But I digress....that's a whole 'nother issue, for another newsgroup.

So the plan was develop in VB, get out there, then transpose into C++. I 
couldn't learn the NNTP 'scene' and VC++ at the same time.

Listen, how 'intense' could this be, basically just controlling winsock 
connections, and parsing strings. It's not like graphics filter's or 
thing's like that.

So anyway, I get 'acceptable' performance from the Jet engine. The main 
issue's in performance are downloading header's. My IP meter tells me 
that I top out at about 1 mBit/sec with 5-6 threads d/l'g after XOVER 
command's. That include's receiving a packet, parsing out each header 
dataset, breaking out each dataset into it's relevant parts, fully 
processing the subject line for multi-part detection (not joined at this 
juncture), looking in the database to see if it's there already, and 
adding it if not.

After all server's are processed for a specific group, a seperate process 
is spawned which goes thru that group's db and join's multi-part's, 
mark's complete or not, expires parts that are off the server(s), yadda 
yadda yadda.... For smaller groups this outside process takes 1-2 
seconds. For the larger groups 6-8. It is at this point that the info is 
ready for use and can be diplayed.

So displaying them I use a 'virtual' listview. Doing this allows me to 
use a table with million's of records and they are all diplayed instantly 
w/o having to load them into a listview. Additionally, all sorting and 
filtering is done by Jet and not me. I just pass an SQL open statement, 
and receive the data I want, sorted how I want, from the groups I want. 
Jet is WAYYYYYYYYY more efficient than I could ever be.

One of my features is 'Virtual Groups' which combine many groups into one 
view. Some quick (altho unscientific) benchmarks:

Virtual group contains 7 groups-alt.binaries.cd.image, a.b.c.i.reposts, 
a.b.c.i.highspeed, a.b.c.i.parts, a.b.i.c.clonecd, a.b.c.i.c.reposts, 
a.b.c.i.games.

After adding up the number of article in their db's. I came out to 
roughly 150,000. About the same number as you had been limiting your list 
to. Your time's reported were for 500K msg's tho. So obviously my numbers 
would be x 3, at least.

What I can tell you is that querying that virtual group, it takes about 
25 seconds for me to open the db, filter out what is NOT to be shown & 
sort, and display it in the virtual listview. Out of the 150,000 ish 
headers, some 5500 or so were actually displayed being either text 
messages, or a single header for a multipart download. Subsequently, each 
column-header click done to re-sort that group in a different manner 
takes 3-4 seconds. A re-sort closes the entire table and open the new 
recordset with the new sort. In the 3-4 seconds. 

When ZaNews is re-written in C++, I estimate a 15% - 25% increase in 
speed. I have come up with this number as an opinion formed by reading 
many bench mark tests for 'other' database engine controls comparing 
their performance between using it is VB or C++.

OK, everyone can laugh now about VB and Jet here. But I'll tell you, so 
far it's been working. Header downloads is the only 'very high' overhead 
that is done. And once you start d/l'g and managing parts and such, the 
actual db action should be quite light.

Regards,

DS

PS- I don't really think I answered his question even....sorry.




Technical Details
Message-ID: <Xns93498CE88447Aidispcom@24.48.107.54>
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!logbridge.uoregon.edu!router1.news.adelphia.net!news1.news.adelphia.net.POSTED!not-for-mail
References: <4540d.o33203@archiver.winews.net>

Show Full Headers
Complete Article Headers
Message-ID: <Xns93498CE88447Aidispcom@24.48.107.54>
Subject: Re: Newsreader programming - sorting one million lines ?
Date: Tue, 25 Mar 2003 18:50:46 GMT
From: DS <t.h.i.s.n.t.h.a.t@a.d.e.l.p.h.i.a..n.e.t>
References: <4540d.o33203@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!logbridge.uoregon.edu!router1.news.adelphia.net!news1.news.adelphia.net.POSTED!not-for-mail
Newsgroups: news.software.nntp
Organization: Home
User-Agent: Xnews/5.04.25
Lines: 100
NNTP-Posting-Host: 68.71.194.138
X-Complaints-To: abuse@adelphia.net
X-Trace: news1.news.adelphia.net 1048618246 68.71.194.138 (Tue, 25 Mar 2003 13:50:46 EST)
NNTP-Posting-Date: Tue, 25 Mar 2003 13:50:46 EST