For very large files we use alternate indexes on Unidata.
So we have one for date or some virtual of data that is used most of the
time.  Then we use a generic subroutine to read the index using either a
SETINDEX to go exactly where you want (or where the next record should
be) or SELECTINDEX it is extremely fast as we use it for our 911
dispatching application where every millisecond counts.


Nick Gettino
Director of Development
EnRoute Emergency Systems
401 E Jackson St
Suite 1500
Tampa FL 33602

-----Original Message-----
From: [EMAIL PROTECTED]
[mailto:[EMAIL PROTECTED] On Behalf Of Rex Gozar
Sent: Wednesday, July 23, 2008 2:50 PM
To: [email protected]
Subject: Re: [U2] Basic SORT() Function not avail in UniVerse?

I've done research on sorting in the past, working with 100,000 to 
1,000,000 element lists.

Allen: LOCATE's are faster, but only when you're dealing with less than 
100 elements.  Because LOCATE's must start at the beginning of a string 
and traverse the entire length, they get slower and slower.  Bubble 
sorts are also useless when dealing with a large number of elements.

Jeff: Yes, a C program is the fastest (at least it was at my last job 
where we used GCI to integrate it with the universe shell.)

As for writing out ids to work files just to sort them, it adds 
unnecessary overhead to the whole process.

I wish universe had an intrinsic sort() function.  Since they don't I 
wrote my own and posted it on PickWiki.  You could also use the 
QuickSort sample posted in this thread.  Once you standardize on a 
particular sorting program, you'll be amazed at the number of times it 
comes in handy.

http://www.pickwiki.com/cgi-bin/wiki.pl?Sorting
http://www.pickwiki.com/cgi-bin/wiki.pl?ShellSort
http://www.pickwiki.com/cgi-bin/wiki.pl?QuickSort

Another handy function is to be able to flip fields to values and vice 
versa.  See http://www.pickwiki.com/cgi-bin/wiki.pl?Row2Col and again 
it's optimized for a large number of elements.

rex
-------
u2-users mailing list
[email protected]
To unsubscribe please visit http://listserver.u2ug.org/
-------
u2-users mailing list
[email protected]
To unsubscribe please visit http://listserver.u2ug.org/

Reply via email to